-- CreateTable CREATE TABLE "resources" ( "id" TEXT NOT NULL PRIMARY KEY, "title" TEXT NOT NULL, "description" TEXT, "url" TEXT NOT NULL, "icon" TEXT, "category" TEXT, "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" DATETIME NOT NULL ); -- RedefineTables PRAGMA defer_foreign_keys=ON; PRAGMA foreign_keys=OFF; CREATE TABLE "new_posts" ( "id" TEXT NOT NULL PRIMARY KEY, "title" TEXT NOT NULL, "content" TEXT NOT NULL, "user_id" TEXT NOT NULL, "published" BOOLEAN NOT NULL DEFAULT false, "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" DATETIME NOT NULL, CONSTRAINT "posts_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE ); INSERT INTO "new_posts" ("content", "createdAt", "id", "title", "updatedAt", "user_id") SELECT "content", "createdAt", "id", "title", "updatedAt", "user_id" FROM "posts"; DROP TABLE "posts"; ALTER TABLE "new_posts" RENAME TO "posts"; PRAGMA foreign_keys=ON; PRAGMA defer_foreign_keys=OFF;