Let's say that I have a script called schema.sql which is used to allocate a new SQLite db with my desired schema.
If this script contains PRAGMA journal_mode = 'wal'; before any DML, is the database continually set to WAL mode? Or is journal mode something that needs to be configured on each connection/command?
The journal mode is only persisted for WAL mode. From the docs:
Unlike the other journaling modes, PRAGMA journal_mode=WAL is persistent. If a process sets WAL mode, then closes and reopens the database, the database will come back in WAL mode. In contrast, if a process sets (for example) PRAGMA journal_mode=TRUNCATE and then closes and reopens the database will come back up in the default rollback mode of DELETE rather than the previous TRUNCATE setting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With