Rask.SQLite.Snapshots 0.20.0

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Rask.SQLite.Snapshots --version 0.20.0
                    
NuGet\Install-Package Rask.SQLite.Snapshots -Version 0.20.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rask.SQLite.Snapshots" Version="0.20.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rask.SQLite.Snapshots" Version="0.20.0" />
                    
Directory.Packages.props
<PackageReference Include="Rask.SQLite.Snapshots" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Rask.SQLite.Snapshots --version 0.20.0
                    
#r "nuget: Rask.SQLite.Snapshots, 0.20.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Rask.SQLite.Snapshots@0.20.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Rask.SQLite.Snapshots&version=0.20.0
                    
Install as a Cake Addin
#tool nuget:?package=Rask.SQLite.Snapshots&version=0.20.0
                    
Install as a Cake Tool

Rask.SQLite.Snapshots

Scheduled, consistent SQLite backups — no external binary. Takes point-in-time file snapshots of a live SQLite database on a schedule using SQLite's Online Backup API (never an unsafe File.Copy of a WAL database), keeps the newest N, and writes them to a directory — or a pluggable store for object storage.

Use it on its own for simple periodic full backups without a sidecar or object storage, or alongside Rask.SQLite.Litestream (continuous streaming) as a second line of defence. Standalone: depends only on Microsoft.Data.Sqlite and the Microsoft.Extensions hosting/DI abstractions.

Install

dotnet add package Rask.SQLite.Snapshots

Use

builder.Services.AddRaskSqliteSnapshots(o =>
{
    o.DatabasePath = "/data/app.db";
    o.DestinationDirectory = "/backups";
    o.Interval = TimeSpan.FromHours(6);
    o.Retain = 14;                  // keep the 14 newest
    o.SnapshotOnStartup = true;     // also take one at boot
});

Snapshots land as app-20260714-030000000.db — each a complete, standalone SQLite database you can open, copy or archive.

Need a backup on demand (say, before a risky migration)? Inject ISqliteSnapshotter:

var name = await snapshotter.SnapshotAsync(ct);

Sending snapshots to object storage instead of a directory? Register your own ISqliteSnapshotStore before AddRaskSqliteSnapshots and DestinationDirectory is no longer required.

To show what you've captured, await store.ListAsync(ct) returns each snapshot's name, size and timestamp, newest first. A custom store inherits a default that returns an empty list — override it if yours can enumerate, because callers can't tell "no snapshots yet" from "this store doesn't list".

Notes

  • Consistent, not a raw copy. The Online Backup API copies pages while writers continue, so the snapshot is a valid database even under load — unlike copying the file yourself.
  • Resilient. A failed snapshot is logged and the schedule continues; a backup problem never crashes the app.
  • Dedicated directory. Point DestinationDirectory at a directory used only for snapshots — pruning is scoped to this database's own files, but a dedicated directory keeps things tidy.

Full documentation: https://github.com/pal-tamas/rask/blob/main/docs/sqlite.md#scheduled-snapshots

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Rask.SQLite.Snapshots:

Package Downloads
Rask.SQLite.Browser

Runs Microsoft.Data.Sqlite (and Entity Framework Core on top of it) inside a browser WebAssembly app, with the database persisted across reloads. The database file lives in the WASM runtime's in-memory filesystem; this package restores it from IndexedDB at boot and writes it back on a schedule and on page-hide, using SQLite's Online Backup API (never an unsafe file copy) via Rask.SQLite.Snapshots. A Web Lock elects one tab as the owner, so several open tabs cannot write over each other. Register `AddRaskBrowserSqlite("app")` and point your DbContext at `BrowserSqlite.ConnectionString("app")` — the same registration you would write on the server.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.20.1-alpha.0.36 34 8/10/2026
0.20.1-alpha.0.18 35 8/8/2026
0.20.1-alpha.0.17 38 8/8/2026
0.20.1-alpha.0.16 36 8/8/2026
0.20.1-alpha.0.15 40 8/7/2026
0.20.1-alpha.0.14 37 8/7/2026
0.20.1-alpha.0.13 38 8/7/2026
0.20.1-alpha.0.12 34 8/7/2026
0.20.1-alpha.0.11 37 8/7/2026
0.20.1-alpha.0.9 31 8/7/2026
0.20.1-alpha.0.8 40 8/7/2026
0.20.1-alpha.0.7 39 8/7/2026
0.20.1-alpha.0.5 38 8/7/2026
0.20.1-alpha.0.4 36 8/7/2026
0.20.1-alpha.0.3 38 8/7/2026
0.20.1-alpha.0.2 35 8/6/2026
0.20.0 46 8/6/2026
0.19.1-alpha.0.75 35 8/6/2026
0.19.1-alpha.0.74 38 8/6/2026
0.19.1-alpha.0.73 40 8/6/2026
Loading failed