Finalize scoring system, release year integration, and fix song deletion
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Song" ADD COLUMN "releaseYear" INTEGER;
|
||||
@@ -0,0 +1,20 @@
|
||||
-- RedefineTables
|
||||
PRAGMA defer_foreign_keys=ON;
|
||||
PRAGMA foreign_keys=OFF;
|
||||
CREATE TABLE "new_DailyPuzzle" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"date" TEXT NOT NULL,
|
||||
"songId" INTEGER NOT NULL,
|
||||
"genreId" INTEGER,
|
||||
"specialId" INTEGER,
|
||||
CONSTRAINT "DailyPuzzle_songId_fkey" FOREIGN KEY ("songId") REFERENCES "Song" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT "DailyPuzzle_genreId_fkey" FOREIGN KEY ("genreId") REFERENCES "Genre" ("id") ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT "DailyPuzzle_specialId_fkey" FOREIGN KEY ("specialId") REFERENCES "Special" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
);
|
||||
INSERT INTO "new_DailyPuzzle" ("date", "genreId", "id", "songId", "specialId") SELECT "date", "genreId", "id", "songId", "specialId" FROM "DailyPuzzle";
|
||||
DROP TABLE "DailyPuzzle";
|
||||
ALTER TABLE "new_DailyPuzzle" RENAME TO "DailyPuzzle";
|
||||
CREATE UNIQUE INDEX "DailyPuzzle_date_genreId_specialId_key" ON "DailyPuzzle"("date", "genreId", "specialId");
|
||||
PRAGMA foreign_keys=ON;
|
||||
PRAGMA defer_foreign_keys=OFF;
|
||||
|
||||
@@ -16,6 +16,7 @@ model Song {
|
||||
artist String
|
||||
filename String // Filename in public/uploads
|
||||
coverImage String? // Filename in public/uploads/covers
|
||||
releaseYear Int? // Release year from MusicBrainz
|
||||
createdAt DateTime @default(now())
|
||||
puzzles DailyPuzzle[]
|
||||
genres Genre[]
|
||||
@@ -62,7 +63,7 @@ model DailyPuzzle {
|
||||
id Int @id @default(autoincrement())
|
||||
date String // Format: YYYY-MM-DD
|
||||
songId Int
|
||||
song Song @relation(fields: [songId], references: [id])
|
||||
song Song @relation(fields: [songId], references: [id], onDelete: Cascade)
|
||||
genreId Int?
|
||||
genre Genre? @relation(fields: [genreId], references: [id])
|
||||
specialId Int?
|
||||
|
||||
Reference in New Issue
Block a user