The foreign_keys
pragma controls the enforcement of
foreign key constraints in all of the attached databases. If set
to off, foreign key constraints are ignored. The default value
is off.
For many years, SQLite would parse foreign key constraints, but was unable to enforce them. When native support for foreign key constraints was finally added to the SQLite core, enforcement was off by default to avoid any backwards compatibility issues.
This default value may change in future releases. To avoid problems, it is recommended that an application explicitly set the pragma one way or the other.
This pragma cannot be set when there is an active transaction in progress.