-- RedefineTables
PRAGMA defer_foreign_keys=ON;
CREATE TABLE "new_Product" (
"id" TEXT NOT NULL PRIMARY KEY,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
"name" TEXT NOT NULL,
"description" TEXT,
...some more rows
CONSTRAINT "Product_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "Event" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "Product_totalCapacityId_fkey" FOREIGN KEY ("totalCapacityId") REFERENCES "Capacity" ("id") ON DELETE SET NULL ON UPDATE CASCADE
);
INSERT INTO "new_Product" ("createdAt", "description", "id", "name", "updatedAt", ...) SELECT "createdAt", "description", "id", "name", "updatedAt", ... FROM "Product";
DROP TABLE "Product";
ALTER TABLE "new_Product" RENAME TO "Product";
PRAGMA foreign_key_check("Product");
PRAGMA defer_foreign_keys=OFF;
-- RedefineTables
PRAGMA defer_foreign_keys=ON;
CREATE TABLE "new_Product" (
"id" TEXT NOT NULL PRIMARY KEY,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
"name" TEXT NOT NULL,
"description" TEXT,
...some more rows
CONSTRAINT "Product_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "Event" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "Product_totalCapacityId_fkey" FOREIGN KEY ("totalCapacityId") REFERENCES "Capacity" ("id") ON DELETE SET NULL ON UPDATE CASCADE
);
INSERT INTO "new_Product" ("createdAt", "description", "id", "name", "updatedAt", ...) SELECT "createdAt", "description", "id", "name", "updatedAt", ... FROM "Product";
DROP TABLE "Product";
ALTER TABLE "new_Product" RENAME TO "Product";
PRAGMA foreign_key_check("Product");
PRAGMA defer_foreign_keys=OFF;