Create migrations
This commit is contained in:
parent
a15db5fb31
commit
51df37aa21
3 changed files with 61 additions and 0 deletions
|
|
@ -0,0 +1,21 @@
|
|||
const std = @import("std");
|
||||
const jetquery = @import("jetquery");
|
||||
const t = jetquery.schema.table;
|
||||
|
||||
pub fn up(repo: anytype) !void {
|
||||
try repo.createTable(
|
||||
"ratings",
|
||||
&.{
|
||||
t.primaryKey("id", .{}),
|
||||
t.column("reference_id", .integer, .{}),
|
||||
t.column("score", .float, .{}),
|
||||
t.column("date", .datetime, .{}),
|
||||
t.timestamps(.{}),
|
||||
},
|
||||
.{},
|
||||
);
|
||||
}
|
||||
|
||||
pub fn down(repo: anytype) !void {
|
||||
try repo.dropTable("ratings", .{});
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
const std = @import("std");
|
||||
const jetquery = @import("jetquery");
|
||||
const t = jetquery.schema.table;
|
||||
|
||||
pub fn up(repo: anytype) !void {
|
||||
try repo.createTable(
|
||||
"aliases",
|
||||
&.{
|
||||
t.primaryKey("id", .{}),
|
||||
t.column("reference_id", .integer, .{}),
|
||||
t.column("alias", .string, .{}),
|
||||
t.timestamps(.{}),
|
||||
},
|
||||
.{},
|
||||
);
|
||||
}
|
||||
|
||||
pub fn down(repo: anytype) !void {
|
||||
try repo.dropTable("aliases", .{});
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
const std = @import("std");
|
||||
const jetquery = @import("jetquery");
|
||||
const t = jetquery.schema.table;
|
||||
|
||||
pub fn up(repo: anytype) !void {
|
||||
try repo.createTable(
|
||||
"concerts",
|
||||
&.{
|
||||
t.primaryKey("id", .{}),
|
||||
t.column("date", .datetime, .{}),
|
||||
t.column("location", .string, .{}),
|
||||
t.timestamps(.{}),
|
||||
},
|
||||
.{},
|
||||
);
|
||||
}
|
||||
|
||||
pub fn down(repo: anytype) !void {
|
||||
try repo.dropTable("concerts", .{});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue