Convert ids to i64

The birthday paradox is a real problem with the size of our datasets. i64 is the largest numerical value we can use, and there's a 0.1% chance of collision with ~2,000,000 values, so I feel pretty comfortable with this
This commit is contained in:
mitteneer 2025-06-09 21:41:52 -04:00
parent c8f2ef57c8
commit 162341fb5f
9 changed files with 21 additions and 27 deletions

View file

@ -6,7 +6,7 @@ pub fn up(repo: anytype) !void {
try repo.createTable(
"songs",
&.{
t.primaryKey("id", .{}),
t.primaryKey("id", .{ .type = .bigint }),
t.column("name", .string, .{}),
t.column("length", .float, .{ .optional = true }),
t.column("hidden", .boolean, .{}),

View file

@ -6,7 +6,7 @@ pub fn up(repo: anytype) !void {
try repo.createTable(
"albums",
&.{
t.primaryKey("id", .{}),
t.primaryKey("id", .{ .type = .bigint }),
t.column("name", .string, .{}),
t.column("length", .float, .{ .optional = true }),
t.timestamps(.{}),

View file

@ -6,9 +6,9 @@ pub fn up(repo: anytype) !void {
try repo.createTable(
"albumsongs",
&.{
t.primaryKey("id", .{}),
t.column("song_id", .integer, .{ .reference = .{ "songs", "id" } }),
t.column("album_id", .integer, .{ .reference = .{ "albums", "id" } }),
t.primaryKey("id", .{ .type = .bigint }),
t.column("song_id", .bigint, .{ .reference = .{ "songs", "id" } }),
t.column("album_id", .bigint, .{ .reference = .{ "albums", "id" } }),
t.timestamps(.{}),
},
.{},

View file

@ -6,8 +6,8 @@ pub fn up(repo: anytype) !void {
try repo.createTable(
"scrobbles",
&.{
t.primaryKey("id", .{}),
t.column("albumsong", .integer, .{ .reference = .{ "albumsongs", "id" } }),
t.primaryKey("id", .{ .type = .bigint }),
t.column("albumsong", .bigint, .{ .reference = .{ "albumsongs", "id" } }),
t.column("datetime", .datetime, .{}),
t.timestamps(.{}),
},

View file

@ -6,7 +6,7 @@ pub fn up(repo: anytype) !void {
try repo.createTable(
"artists",
&.{
t.primaryKey("id", .{}),
t.primaryKey("id", .{ .type = .bigint }),
t.column("name", .string, .{}),
t.column("disambiguation", .string, .{ .optional = true }),
t.timestamps(.{}),

View file

@ -6,9 +6,9 @@ pub fn up(repo: anytype) !void {
try repo.createTable(
"albumsongsartists",
&.{
t.primaryKey("id", .{}),
t.column("albumsong_id", .integer, .{ .reference = .{ "albumsongs", "id" } }),
t.column("artist_id", .integer, .{ .reference = .{ "artists", "id" } }),
t.primaryKey("id", .{ .type = .bigint }),
t.column("albumsong_id", .bigint, .{ .reference = .{ "albumsongs", "id" } }),
t.column("artist_id", .bigint, .{ .reference = .{ "artists", "id" } }),
t.timestamps(.{}),
},
.{},

View file

@ -6,9 +6,9 @@ pub fn up(repo: anytype) !void {
try repo.createTable(
"artistalbums",
&.{
t.primaryKey("id", .{}),
t.column("album_id", .integer, .{ .reference = .{ "albums", "id" } }),
t.column("artist_id", .integer, .{ .reference = .{ "artists", "id" } }),
t.primaryKey("id", .{ .type = .bigint }),
t.column("album_id", .bigint, .{ .reference = .{ "albums", "id" } }),
t.column("artist_id", .bigint, .{ .reference = .{ "artists", "id" } }),
t.timestamps(.{}),
},
.{},