Fix initial Schema creation

Update JetQuery - `optional` replaces `not_null` and defaults to `false`,
i.e. columns have a `NOT NULL` constraint by default.
This commit is contained in:
Bob Farrell 2024-11-14 20:18:28 +00:00
parent 7e973bbc3b
commit 9ebf0d40e6
2 changed files with 6 additions and 4 deletions

View File

@ -15,8 +15,8 @@
.hash = "12201d75d73aad5e1c996de4d5ae87a00e58479c8d469bc2eeb5fdeeac8857bc09af", .hash = "12201d75d73aad5e1c996de4d5ae87a00e58479c8d469bc2eeb5fdeeac8857bc09af",
}, },
.jetquery = .{ .jetquery = .{
.url = "https://github.com/jetzig-framework/jetquery/archive/2dc9565ecbb07cdad33726b9a4e199fdb9150eec.tar.gz", .url = "https://github.com/jetzig-framework/jetquery/archive/27284df6208b982d4d611fca0cc083a306c8602a.tar.gz",
.hash = "122027b41c17ba3459fa7992f88f2b27659cace0176fecab2ae362687ac1dcb5be2b", .hash = "12202722110cbfc467097478e5d7329ae544b1f77de684952ec63eb916d07a653e49",
}, },
.jetcommon = .{ .jetcommon = .{
.url = "https://github.com/jetzig-framework/jetcommon/archive/a248776ba56d6cc2b160d593ac3305756adcd26e.tar.gz", .url = "https://github.com/jetzig-framework/jetcommon/archive/a248776ba56d6cc2b160d593ac3305756adcd26e.tar.gz",

View File

@ -100,9 +100,11 @@ pub fn main() !void {
}, },
); );
const schema = try reflect.generateSchema(); const schema = try reflect.generateSchema();
const path = try cwd.realpathAlloc( const project_dir = try jetzig.util.detectJetzigProjectDir();
const project_dir_realpath = try project_dir.realpathAlloc(allocator, ".");
const path = try std.fs.path.join(
allocator, allocator,
try std.fs.path.join(allocator, &.{ "src", "app", "database", "Schema.zig" }), &.{ project_dir_realpath, "src", "app", "database", "Schema.zig" },
); );
try jetzig.util.createFile(path, schema); try jetzig.util.createFile(path, schema);
std.log.info("Database schema written to `{s}`.", .{path}); std.log.info("Database schema written to `{s}`.", .{path});