Enabling foreign_keys produces SqliteException 787 #2730
Unanswered
patrikbadanjak
asked this question in
Q&A
Replies: 1 comment
-
This error code indicates that a foreign key constraint has failed. The cause is likely that you already have a final rows = await customSelect('pragma foreign_key_check;').get();
for (final row in rows) {
print('Foreign key mismatch: ${row.data}');
}
You will have to find the offending rows and fix them. How to do that depends on your application, it might make sense to delete them or maybe they need to be updated or the row they're referencing is missing and needs to be inserted. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Turning on the foreign_keys pragma inside onUpgrade or beforeOpen methods produces SqliteException 787. What causes this and how do I mitigate it? The database is running on the separate isolate as per the documentation.
Beta Was this translation helpful? Give feedback.
All reactions