“labl_id” INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,*
“name” TEXT NOT NULL,*
“slug” TEXT NOT NULL,*
“logo” TEXT,*
“is_niche” BOOLEAN NOT NULL DEFAULT false* ); INSERT INTO “new_Label” (“labl_id”, “logo”, “name”, “slug”) SELECT “labl_id”, “logo”, “name”, “slug” FROM “Label”; DROP TABLE “Label”; ALTER TABLE “new_Label” RENAME TO “Label”; CREATE INDEX “Label_slug_idx” ON “Label”(“slug”); PRAGMA foreign_keys=ON; PRAGMA defer_foreign_keys=OFF;
I receive the following error: D1 DB exceeded its CPU time limit and was reset.
So I’ve ended up having to just rename the table that was supposed to be dropped by the migration and then renaming the new table to the name that is required.
This is a fairly severe limitation of D1 and the CPU time limits.
DROP TABLE causes:
D1 DB storage operation exceeded timeout which caused object to be reset.
Surely a DROP TABLE statement should be able to proceed no matter the size of the table?
If anyone else has this issue I suggest deleting your database and creating a new one.
I can’t explain why a simple DROP TABLE statement would raise this error: D1 DB storage operation exceeded timeout which caused object to be reset.
I have a database reset script that drops all tables in my database that I’ve run hundreds of
times successfully but my DB must have ended up with a lock of some kind that could not be resolved.
Delete the DB and start again seems to be the solution.