Enable foreign key enforcement
Turn on FK checks for the current connection.
PRAGMA foreign_keys = ON;Foreign key enforcement is connection-specific and should usually be enabled explicitly by applications.
High-signal PRAGMA commands for foreign keys, cache, synchronous settings, page size, temp storage, health checks, and general SQLite administration.
Enable important safety settings and inspect database health.
Turn on FK checks for the current connection.
PRAGMA foreign_keys = ON;Foreign key enforcement is connection-specific and should usually be enabled explicitly by applications.
Read whether FK enforcement is enabled.
PRAGMA foreign_keys;Useful when debugging unexpected orphan rows or migration behavior.
PRAGMA foreign_key_check;A great migration verification step.
PRAGMA quick_check;Faster than a full integrity check and handy for routine validation.
Inspect or tune journaling, cache, and storage behavior.
PRAGMA page_size;Page size is part of the file format and relevant for some performance and storage investigations.
Adjust the number of pages or kibibytes used for page cache.
PRAGMA cache_size = -20000;Negative values are interpreted as kibibytes, making sizing easier in some deployments.
PRAGMA synchronous = NORMAL;A common setting in WAL mode when balancing performance and durability.
Choose file-backed or memory temp storage.
PRAGMA temp_store = MEMORY;Can help workloads that build temporary btrees, sorts, or transient intermediate results.
Read or set the user-defined schema version number.
PRAGMA user_version;
PRAGMA user_version = 12;A simple and popular migration bookkeeping mechanism in SQLite apps.