feat: Add id column to song table and prep for UUID migration

- Add id serial4 PK to song table (was composite PK)
- Update queries to use soundtrack_id + path
- Add UUID columns to soundtrack and song (nullable)
- Add migration tracking table

TODO: Run sqlc generate, then create backfill migration (000008)

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
2026-06-01 21:58:21 +02:00
parent 2bc9012a01
commit 9256b7fe4b
8 changed files with 174 additions and 50 deletions
+27 -16
View File
@@ -10,6 +10,14 @@ import (
"github.com/jackc/pgx/v5/pgtype"
)
type IDMigrationStatus struct {
TableName string `json:"table_name"`
TotalRows int32 `json:"total_rows"`
MigratedRows int32 `json:"migrated_rows"`
Completed bool `json:"completed"`
StartedAt *time.Time `json:"started_at"`
}
type Session struct {
Token string `json:"token"`
IpAddress string `json:"ip_address"`
@@ -20,12 +28,14 @@ type Session struct {
}
type Song struct {
SoundtrackID int32 `json:"soundtrack_id"`
SongName string `json:"song_name"`
Path string `json:"path"`
TimesPlayed int32 `json:"times_played"`
Hash string `json:"hash"`
FileName *string `json:"file_name"`
SoundtrackID int32 `json:"soundtrack_id"`
SongName string `json:"song_name"`
Path string `json:"path"`
TimesPlayed int32 `json:"times_played"`
Hash string `json:"hash"`
FileName *string `json:"file_name"`
ID pgtype.Int4 `json:"id"`
Uuid pgtype.UUID `json:"uuid"`
}
type SongList struct {
@@ -37,16 +47,17 @@ type SongList struct {
}
type Soundtrack struct {
ID int32 `json:"id"`
SoundtrackName string `json:"soundtrack_name"`
Added time.Time `json:"added"`
Deleted *time.Time `json:"deleted"`
LastChanged *time.Time `json:"last_changed"`
Path string `json:"path"`
TimesPlayed int32 `json:"times_played"`
LastPlayed *time.Time `json:"last_played"`
NumberOfSongs int32 `json:"number_of_songs"`
Hash string `json:"hash"`
ID int32 `json:"id"`
SoundtrackName string `json:"soundtrack_name"`
Added time.Time `json:"added"`
Deleted *time.Time `json:"deleted"`
LastChanged *time.Time `json:"last_changed"`
Path string `json:"path"`
TimesPlayed int32 `json:"times_played"`
LastPlayed *time.Time `json:"last_played"`
NumberOfSongs int32 `json:"number_of_songs"`
Hash string `json:"hash"`
Uuid pgtype.UUID `json:"uuid"`
}
type Vgmq struct {