From 496a70ffed2d335c70163e301cdcea5282dcad3c Mon Sep 17 00:00:00 2001 From: Rudi Date: Thu, 27 Aug 2026 15:00:04 +0200 Subject: [PATCH] Update on Songbooksongs number Number of Song in a Songbook is not number anymore but string so "3a" would work. --- .../migration.sql | 17 +++++++++++++++++ prisma/schema.prisma | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 prisma/migrations/20260827120723_number_to_string/migration.sql diff --git a/prisma/migrations/20260827120723_number_to_string/migration.sql b/prisma/migrations/20260827120723_number_to_string/migration.sql new file mode 100644 index 0000000..b89fe56 --- /dev/null +++ b/prisma/migrations/20260827120723_number_to_string/migration.sql @@ -0,0 +1,17 @@ +-- RedefineTables +PRAGMA defer_foreign_keys=ON; +PRAGMA foreign_keys=OFF; +CREATE TABLE "new_SongBookSongs" ( + "songBookId" INTEGER NOT NULL, + "songId" INTEGER NOT NULL, + "songNumber" TEXT NOT NULL, + + PRIMARY KEY ("songBookId", "songId"), + CONSTRAINT "SongBookSongs_songId_fkey" FOREIGN KEY ("songId") REFERENCES "Song" ("id") ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT "SongBookSongs_songBookId_fkey" FOREIGN KEY ("songBookId") REFERENCES "SongBook" ("id") ON DELETE CASCADE ON UPDATE CASCADE +); +INSERT INTO "new_SongBookSongs" ("songBookId", "songId", "songNumber") SELECT "songBookId", "songId", "songNumber" FROM "SongBookSongs"; +DROP TABLE "SongBookSongs"; +ALTER TABLE "new_SongBookSongs" RENAME TO "SongBookSongs"; +PRAGMA foreign_keys=ON; +PRAGMA defer_foreign_keys=OFF; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 62de787..b7b2a74 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -35,7 +35,7 @@ model SongBook { model SongBookSongs { songBookId Int songId Int - songNumber Int + songNumber String song Song @relation(fields: [songId], references: [id], onDelete: Cascade) book SongBook @relation(fields: [songBookId], references: [id], onDelete: Cascade)