hermes/prisma/migrations/20240419124642_fix_fixes_permission_ids/migration.sql

21 lines
889 B
SQL

/*
Warnings:
- The primary key for the `Permission` table will be changed. If it partially fails, the table could be left without primary key constraint.
- Added the required column `id` to the `Permission` table without a default value. This is not possible if the table is not empty.
*/
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_Permission" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"permission" TEXT NOT NULL,
"has" BOOLEAN NOT NULL,
"userID" INTEGER NOT NULL,
CONSTRAINT "Permission_userID_fkey" FOREIGN KEY ("userID") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_Permission" ("has", "permission", "userID") SELECT "has", "permission", "userID" FROM "Permission";
DROP TABLE "Permission";
ALTER TABLE "new_Permission" RENAME TO "Permission";
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;