You can declare a FOREIGN KEY in a SQLite table and still delete the parent row it points to without any complaint. I find that surprising for a database, and it is the reason for this tip: enforcement is a setting, and it is not on by default.
sqlite3 app.db
sqlite> PRAGMA foreign_keys;
0
sqlite> PRAGMA foreign_keys = ON;
sqlite> PRAGMA foreign_keys;
1
The docs say that since SQLite 3.6.19 the default is off, that it may change in a future release, and that applications should set the flag they need and not depend on the default. The default can also be changed when SQLite is compiled, so the answer on one machine is not the answer on another. That is why I would ask for the value on each connection.
Two behaviours that catch people out. The pragma is a no-op inside a transaction: enforcement can only be switched when there is no pending BEGIN or SAVEPOINT. And it belongs to the connection. Per the docs it affects all statements prepared on that connection, but a new connection starts again from the default, so the app has to run it every time it connects. Typing it once in the shell does not change the database file.
The caveat for existing data: turning enforcement on is not described as cleaning up rows that already violate a constraint. To find those, SQLite has a second pragma, PRAGMA foreign_key_check;. The docs say it checks the database, or one table, and returns one row for each violated foreign key.
Further reading: SQLite: PRAGMA Statements (foreign_keys)