database: Allow tracks without medium

This commit is contained in:
Elias Projahn 2023-02-11 11:13:13 +01:00
parent 7eb85f094f
commit a3f585aadf
4 changed files with 35 additions and 5 deletions

View file

@ -0,0 +1,15 @@
CREATE TABLE "new_tracks" (
"id" TEXT NOT NULL PRIMARY KEY,
"medium" TEXT REFERENCES "mediums"("id") ON DELETE CASCADE,
"index" INTEGER NOT NULL,
"recording" TEXT NOT NULL REFERENCES "recordings"("id"),
"work_parts" TEXT NOT NULL,
"source_index" INTEGER NOT NULL,
"path" TEXT NOT NULL,
"last_used" BIGINT,
"last_played" BIGINT
);
INSERT INTO "new_tracks" SELECT * FROM "tracks";
DROP TABLE "tracks";
ALTER TABLE "new_tracks" RENAME TO "tracks";