Remix.run Logo
wild_egg 2 days ago

What? Why are you backing up the WAL?

    sqlite3 source_database.db ".backup backup_database.db"
Now the WAL content is rolled into your new backup file. Stick a timestamp in the backup file name and run this as a cron job every N minutes and you have all the recovery you need. Another one-liner to sync to S3 and you're all set.

Edit: And just to clarify, that command can be run on a live DB as it's being used by your app server. SQLite handles external concurrent readers just fine.

sgt a day ago | parent [-]

Thanks for the tip, that will work fine as long as the WAL content is rolled up.