Skip to main content

backup_to

Function backup_to 

Source
pub async fn backup_to(pool: &SqlitePool, dest: &Path) -> DbResult<()>
Expand description

Writes a complete, consistent, compacted snapshot of pool’s database to dest.

Uses SQLite’s own VACUUM INTO: an online operation (it doesn’t block pool’s other readers/writers) that produces a plain, single-file, non-WAL database — the most portable on-disk form, with no -wal/-shm sidecar files that would also need copying.

dest must not already exist. VACUUM INTO refuses to overwrite a file, and that’s the right behavior for a backup command: silently clobbering a previous backup because of a reused filename would be its own data-loss bug, not a convenience worth having.