Database-Layout

Das Datanbankschema wurde an das alte angepasst.
!!Hinzugefügt wurde 'User'!!
This commit is contained in:
rudi committed 2026-07-30 11:48:00 +02:00
1 parent 9aa94638d9
commit 4ccd860814
3 files changed
+82 -14

No files matched your search

@@ -0,0 +1,54 @@
/*
Warnings:
- You are about to drop the column `email` on the `User` table. All the data in the column will be lost.
- You are about to drop the column `firstname` on the `User` table. All the data in the column will be lost.
- You are about to drop the column `lastname` on the `User` table. All the data in the column will be lost.
*/
-- CreateTable
CREATE TABLE "Song" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"title" TEXT NOT NULL
);
-- CreateTable
CREATE TABLE "SongBook" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"title" TEXT NOT NULL,
"language" TEXT NOT NULL
);
-- CreateTable
CREATE TABLE "SongBookSongs" (
"SongBookId" INTEGER NOT NULL,
"SongId" INTEGER NOT NULL,
"songNumber" INTEGER 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
);
-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_User" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"username" TEXT NOT NULL,
"password" TEXT NOT NULL,
"role" TEXT NOT NULL DEFAULT 'user',
"name" TEXT
);
INSERT INTO "new_User" ("id", "password", "role", "username") SELECT "id", "password", "role", "username" FROM "User";
DROP TABLE "User";
ALTER TABLE "new_User" RENAME TO "User";
CREATE UNIQUE INDEX "User_username_key" ON "User"("username");
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;
-- CreateIndex
CREATE UNIQUE INDEX "Song_title_key" ON "Song"("title");
-- CreateIndex
CREATE UNIQUE INDEX "SongBook_title_key" ON "SongBook"("title");