[BUG]: Cannot update SQLite database due to foreign key constraints.
Problem
What version of `drizzle-orm` are you using? 0.29.3 What version of `drizzle-kit` are you using? 0.20.13 Describe the Bug I don't have a reproducible demo created, but after making the following change: and trying to run `pnpm drizzle-kit sqlite:push`, I initially got this error: [code block] When I run it again, it prompts me to confirm that I want to delete `__old_push_projects` [code block] and upon agreeing, I get the same error: [code block] (I updated my drizzle-kit to latest and it produced the same error) Expected behavior Drizzle-kit should update my database. I'm not sure what the best approaches to this would be, since SQLite's table alters are pretty limited in what they can do, but maybe we can do something similar to how the Knex ORM resolved a similar issue in #4155 where they disabled foreign key checks temporarily using `PRAGMA foreign_keys = ON/OFF;` and retroactively checking post-migration with `PRAGMA foreign_key_check;` (see 7. Making Other Kinds Of Table Schema Changes on the sqlite.org site) Environment & setup node v21.5.0 better-sqlite3 9.2.2 edit: just realized I probably should've opened this issue on drizzle-kit, not sure how to transfer issues on GitHub though.
Error Output
Error: FOREIGN KEY constraint failed
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: [BUG]: Cannot update SQLite database due to foreign key constraints.
Any updates on this issue? Still facing problems trying to migrate here.
Trust Score
4 verifications
- 1
Any updates on this issue? Still facing problems trying to migrate here.
Any updates on this issue? Still facing problems trying to migrate here.
Validation
Resolved in drizzle-team/drizzle-orm GitHub issue #1813. Community reactions: 6 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep