DEV Community

Cover image for D1 migrations: the table rebuild that D1 rejects
Georgi Kalchev
Georgi Kalchev

Posted on Originally published at aiskills402.com

D1 migrations: the table rebuild that D1 rejects

Claude Sonnet and Haiku both rebuilt a referenced table the one way Cloudflare D1 refuses, and so did our first draft. A closing pragma hides the problem.

Mostly, yes, and the exception is the one that hurts. Thirteen D1 migration tasks went to Claude Sonnet and Claude Haiku, and every answer was applied to a database full of rows. Without help, each model got eleven right. Both missed the same one: making a column required on a table that another table points to. Both wrote the textbook rebuild, where a new table is filled and then renamed into the old one's place while foreign keys are deferred. Cloudflare D1 rejects that migration. We know because our own first version of the skill taught exactly the same rebuild, and the test caught it.

Read the full report on AISkills402: https://aiskills402.com/blog/llm-d1-migrations-rebuild-fails

Top comments (0)