26 lines
969 B
SQL
26 lines
969 B
SQL
/*
|
|
Warnings:
|
|
|
|
- Added the required column `slug` to the `Post` table without a default value. This is not possible if the table is not empty.
|
|
|
|
*/
|
|
-- RedefineTables
|
|
PRAGMA defer_foreign_keys=ON;
|
|
PRAGMA foreign_keys=OFF;
|
|
CREATE TABLE "new_Post" (
|
|
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
|
"title" TEXT NOT NULL,
|
|
"description" TEXT NOT NULL,
|
|
"slug" TEXT NOT NULL,
|
|
"content" TEXT NOT NULL,
|
|
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"updatedAt" DATETIME NOT NULL,
|
|
"userId" INTEGER,
|
|
CONSTRAINT "Post_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
|
);
|
|
INSERT INTO "new_Post" ("content", "createdAt", "description", "id", "title", "updatedAt", "userId") SELECT "content", "createdAt", "description", "id", "title", "updatedAt", "userId" FROM "Post";
|
|
DROP TABLE "Post";
|
|
ALTER TABLE "new_Post" RENAME TO "Post";
|
|
PRAGMA foreign_keys=ON;
|
|
PRAGMA defer_foreign_keys=OFF;
|