she QUERY on my DATA so she's BASEd
This commit is contained in:
parent
29f8837f19
commit
0537ef7db2
13 changed files with 16 additions and 116 deletions
|
|
@ -15,7 +15,7 @@ pub const database = .{
|
|||
.port = 5432,
|
||||
.username = "postgres",
|
||||
.password = "postgres",
|
||||
.database = "zuletzt_dev",
|
||||
.database = "zuletzt_rsql",
|
||||
.pool_size = 16,
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
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", .{});
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
const std = @import("std");
|
||||
const jetquery = @import("jetquery");
|
||||
const t = jetquery.schema.table;
|
||||
|
||||
pub fn up(repo: anytype) !void {
|
||||
try repo.createTable(
|
||||
"Albumartists",
|
||||
&.{
|
||||
t.primaryKey("id", .{}),
|
||||
t.column("album_id", .integer, .{}),
|
||||
t.column("artist_id", .integer, .{}),
|
||||
t.timestamps(.{}),
|
||||
},
|
||||
.{},
|
||||
);
|
||||
}
|
||||
|
||||
pub fn down(repo: anytype) !void {
|
||||
try repo.dropTable("Albumartists", .{});
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
const std = @import("std");
|
||||
const jetquery = @import("jetquery");
|
||||
const t = jetquery.schema.table;
|
||||
|
||||
pub fn up(repo: anytype) !void {
|
||||
try repo.createTable(
|
||||
"Songartists",
|
||||
&.{
|
||||
t.primaryKey("id", .{}),
|
||||
t.column("song_id", .integer, .{}),
|
||||
t.column("artist_id", .integer, .{}),
|
||||
t.timestamps(.{}),
|
||||
},
|
||||
.{},
|
||||
);
|
||||
}
|
||||
|
||||
pub fn down(repo: anytype) !void {
|
||||
try repo.dropTable("Songartists", .{});
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
const std = @import("std");
|
||||
const jetquery = @import("jetquery");
|
||||
const t = jetquery.schema.table;
|
||||
|
||||
pub fn up(repo: anytype) !void {
|
||||
try repo.createTable(
|
||||
"Albumsongs",
|
||||
&.{
|
||||
t.primaryKey("id", .{}),
|
||||
t.column("album_id", .integer, .{}),
|
||||
t.column("song_id", .integer, .{}),
|
||||
t.timestamps(.{}),
|
||||
},
|
||||
.{},
|
||||
);
|
||||
}
|
||||
|
||||
pub fn down(repo: anytype) !void {
|
||||
try repo.dropTable("Albumsongs", .{});
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
const std = @import("std");
|
||||
const jetquery = @import("jetquery");
|
||||
const t = jetquery.schema.table;
|
||||
|
||||
pub fn up(repo: anytype) !void {
|
||||
try repo.createTable(
|
||||
"Scrobbleartists",
|
||||
&.{
|
||||
t.primaryKey("id", .{}),
|
||||
t.column("scrobble_id", .integer, .{}),
|
||||
t.column("artist_id", .integer, .{}),
|
||||
t.timestamps(.{}),
|
||||
},
|
||||
.{},
|
||||
);
|
||||
}
|
||||
|
||||
pub fn down(repo: anytype) !void {
|
||||
try repo.dropTable("Scrobbleartists", .{});
|
||||
}
|
||||
|
|
@ -4,11 +4,11 @@ const t = jetquery.schema.table;
|
|||
|
||||
pub fn up(repo: anytype) !void {
|
||||
try repo.createTable(
|
||||
"aliases",
|
||||
"albumsongs",
|
||||
&.{
|
||||
t.primaryKey("id", .{}),
|
||||
t.column("reference_id", .integer, .{}),
|
||||
t.column("alias", .string, .{}),
|
||||
t.column("song_id", .integer, .{ .reference = .{ "songs", "id" } }),
|
||||
t.column("album_id", .integer, .{ .reference = .{ "albums", "id" } }),
|
||||
t.timestamps(.{}),
|
||||
},
|
||||
.{},
|
||||
|
|
@ -16,5 +16,5 @@ pub fn up(repo: anytype) !void {
|
|||
}
|
||||
|
||||
pub fn down(repo: anytype) !void {
|
||||
try repo.dropTable("aliases", .{});
|
||||
try repo.dropTable("albumsongs", .{});
|
||||
}
|
||||
|
|
@ -7,9 +7,8 @@ pub fn up(repo: anytype) !void {
|
|||
"scrobbles",
|
||||
&.{
|
||||
t.primaryKey("id", .{}),
|
||||
t.column("song_id", .integer, .{}),
|
||||
t.column("album_id", .integer, .{}),
|
||||
t.column("date", .datetime, .{}),
|
||||
t.column("albumsong", .integer, .{ .reference = .{ "albumsongs", "id" } }),
|
||||
t.column("datetime", .datetime, .{}),
|
||||
t.timestamps(.{}),
|
||||
},
|
||||
.{},
|
||||
|
|
@ -8,7 +8,7 @@ pub fn up(repo: anytype) !void {
|
|||
&.{
|
||||
t.primaryKey("id", .{}),
|
||||
t.column("name", .string, .{}),
|
||||
t.column("descriptive_string", .string, .{}),
|
||||
t.column("disambiguation", .string, .{ .optional = true }),
|
||||
t.timestamps(.{}),
|
||||
},
|
||||
.{},
|
||||
|
|
@ -4,10 +4,11 @@ const t = jetquery.schema.table;
|
|||
|
||||
pub fn up(repo: anytype) !void {
|
||||
try repo.createTable(
|
||||
"mastersongs",
|
||||
"albumsongsartists",
|
||||
&.{
|
||||
t.primaryKey("id", .{}),
|
||||
t.column("name", .string, .{}),
|
||||
t.column("albumsong_id", .integer, .{ .reference = .{ "albumsongs", "id" } }),
|
||||
t.column("artist_id", .integer, .{ .reference = .{ "artists", "id" } }),
|
||||
t.timestamps(.{}),
|
||||
},
|
||||
.{},
|
||||
|
|
@ -15,5 +16,5 @@ pub fn up(repo: anytype) !void {
|
|||
}
|
||||
|
||||
pub fn down(repo: anytype) !void {
|
||||
try repo.dropTable("mastersongs", .{});
|
||||
try repo.dropTable("albumsongsartists", .{});
|
||||
}
|
||||
|
|
@ -4,10 +4,11 @@ const t = jetquery.schema.table;
|
|||
|
||||
pub fn up(repo: anytype) !void {
|
||||
try repo.createTable(
|
||||
"masteralbums",
|
||||
"artistalbums",
|
||||
&.{
|
||||
t.primaryKey("id", .{}),
|
||||
t.column("name", .string, .{}),
|
||||
t.column("album_id", .integer, .{ .reference = .{ "albums", "id" } }),
|
||||
t.column("artist_id", .integer, .{ .reference = .{ "artists", "id" } }),
|
||||
t.timestamps(.{}),
|
||||
},
|
||||
.{},
|
||||
|
|
@ -15,5 +16,5 @@ pub fn up(repo: anytype) !void {
|
|||
}
|
||||
|
||||
pub fn down(repo: anytype) !void {
|
||||
try repo.dropTable("masteralbums", .{});
|
||||
try repo.dropTable("artistalbums", .{});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue