she QUERY on my DATA so she's BASEd

This commit is contained in:
mitteneer 2025-04-07 10:44:28 -04:00
parent 29f8837f19
commit 0537ef7db2
13 changed files with 16 additions and 116 deletions

View file

@ -15,7 +15,7 @@ pub const database = .{
.port = 5432,
.username = "postgres",
.password = "postgres",
.database = "zuletzt_dev",
.database = "zuletzt_rsql",
.pool_size = 16,
},

View file

@ -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", .{});
}

View file

@ -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", .{});
}

View file

@ -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", .{});
}

View file

@ -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", .{});
}

View file

@ -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", .{});
}

View file

@ -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", .{});
}

View file

@ -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(.{}),
},
.{},

View file

@ -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(.{}),
},
.{},

View file

@ -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", .{});
}

View file

@ -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", .{});
}