When I import a DUMP into an SQlite3 database I manually have to activate the foreign_keys again afterwards.
PRAGMA foreign_keys = ON;
When creating a dump the dump looks like this:
PRAGMA foreign_keys = OFF;
BEGIN TRANSACTION;
[...]
COMMIT;
When I add the activation command manually it is ignored:
PRAGMA foreign_keys = OFF;
BEGIN TRANSACTION;
[...]
COMMIT;
PRAGMA foreign_keys = ON;
Is there a way to reactivate the foreign_keys automatically when a Dump is imported?
The
PRAGMA foreign_keys = ON;does activate foreign keys.However, this setting is not stored in the database.
You have to execute this pragma for every new connection to the database.