Task: SQLite checks foreign keys in the functional tests 

Description 

The functional tests on SQLite check and cascade foreign keys, as MariaDB and PostgreSQL do. SQLite leaves foreign keys unchecked unless every connection asks for them; the test support now asks, except while migrations build or change the schema.

Impact 

None for users.