← Graph

SQLite Foreign Key Debugging

concept 1 connections

Unlike Postgres, SQLite reports foreign-key violations only with an error code — no indication of which constraint, table or row failed. Wrona's workaround: disable foreign keys (`PRAGMA foreign_keys = OFF`), execute the offending query, then run `PRAGMA foreign_key_check` which lists all violations. Viable on development/staging but not on production data. He describes this as the biggest frustration of the migration.

category
practice
about
SQLite Foreign Key Debugging concept
Largest frustration of the migration; PRAGMA foreign_key_check workaround.

Provenance

Read by
1 extraction