feat(10-01): update SQL schema files for multi-library fresh installs
- Create _libraries.sql with libraries table (name, path, created_at) - Add library_id FK column and index to audio_files.sql - Update playlist_tracks.sql with nullable audio_file_id, SET NULL FK, and 6 phantom columns - Add af.library_id to track_metadata VIEW - Regenerate sqlc code for updated schemas - Fix playlist.go to use sql.NullInt64 for nullable audio_file_id
This commit is contained in:
@@ -10,9 +10,14 @@ CREATE TABLE IF NOT EXISTS audio_files (
|
||||
bitrate int NOT NULL DEFAULT 0,
|
||||
file_size int NOT NULL DEFAULT 0,
|
||||
basename text NOT NULL DEFAULT '',
|
||||
library_id int NOT NULL DEFAULT 0,
|
||||
FOREIGN KEY(file_type_id) REFERENCES file_types(id),
|
||||
FOREIGN KEY(recording_id) REFERENCES recordings(id)
|
||||
FOREIGN KEY(recording_id) REFERENCES recordings(id),
|
||||
FOREIGN KEY(library_id) REFERENCES libraries(id)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_audio_files_recording_id
|
||||
ON audio_files(recording_id);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_audio_files_library_id
|
||||
ON audio_files(library_id);
|
||||
|
||||
Reference in New Issue
Block a user