-- RedefineTables PRAGMA defer_foreign_keys=ON; PRAGMA foreign_keys=OFF; CREATE TABLE "new_Genre" ( "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "name" TEXT NOT NULL, "storyId" INTEGER, "pubId" INTEGER, CONSTRAINT "Genre_storyId_fkey" FOREIGN KEY ("storyId") REFERENCES "Story" ("id") ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT "Genre_pubId_fkey" FOREIGN KEY ("pubId") REFERENCES "Pub" ("id") ON DELETE SET NULL ON UPDATE CASCADE ); INSERT INTO "new_Genre" ("id", "name") SELECT "id", "name" FROM "Genre"; DROP TABLE "Genre"; ALTER TABLE "new_Genre" RENAME TO "Genre"; PRAGMA foreign_keys=ON; PRAGMA defer_foreign_keys=OFF;