turso-cli
turso-cli copied to clipboard
`turso dev --db-file` needs to better handle the case where the sqlite db file is not suitable for use in sqld
Database files created by sqlite3 default to DELETE journal mode
# Create db file
$ sqlite3 test.db
But sqld requires them to be in WAL journal mode. This error surfaces if it is not:
# Try to get sqld to use the file directly
$ turso dev --db-file test.db
...
Error: failed to checkpoint database while recovering replication log
See: https://www.sqlite.org/wal.html#activating_and_configuring_wal_mode
A workaround here is obviously for the user of the CLI to run PRAGMA journal_mode=WAL;
prior to using the file with the Turso CLI (and sqld).
On sqld: https://github.com/libsql/sqld/issues/558
cc @gamebox