koibot/prisma/migrations/20230628154831_wow/migration.sql

21 lines
718 B
MySQL
Raw Normal View History

2023-06-29 01:11:08 +09:00
/*
Warnings:
- Made the column `sessionId` on table `File` required. This step will fail if there are existing NULL values in that column.
*/
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_File" (
"id" TEXT NOT NULL PRIMARY KEY,
"filename" TEXT NOT NULL,
"timestamp" BIGINT NOT NULL,
"sessionId" TEXT NOT NULL,
CONSTRAINT "File_sessionId_fkey" FOREIGN KEY ("sessionId") REFERENCES "Session" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
INSERT INTO "new_File" ("filename", "id", "sessionId", "timestamp") SELECT "filename", "id", "sessionId", "timestamp" FROM "File";
DROP TABLE "File";
ALTER TABLE "new_File" RENAME TO "File";
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;