libsql
libsql copied to clipboard
Improve error handling on databases without metadata
If you dump a database and create a database file out of it:
turso db shell example .dump > example.sql
cat example.sql | sqlite3 example.db
sqlite3 example.db 'PRAGMA journal_mode = WAL'
The sync code happily allows to sync this with no knowledge of the previous sync point and, therefore, eventually corrupt the database.
Let's add error handling to detect a SQLite file without sync metadata and refuse to sync.