Persistence
A database stores related records so an app can retrieve and update them across launches. Day’s persistence extension uses SQLite for structured data that needs queries and coordinated changes.
day-persistence is a separately versioned, first-party extension built on Day’s public model and reactive APIs. Apps add it as an optional dependency.
Add to your app
Add both to your app:
cargo add 'day-app@0.*' --rename day --features model
cargo add 'day-persistence@0.*'
The default features provide bundled SQLite and the live-list adapter. Other options include
system SQLite, SQLCipher, and date/time codecs. day-model remains part of Day and works without
persistence.
- Full persistence guide
- Persistence Lab demo: database management, SQL execution and tracing, typed records, and JSON import/export.
- Regression tests
The web
The extension’s day-sqlite-worker crate owns its SQLite engine, OPFS worker, and browser
protocol. Day discovers its browser files through [package.metadata.day.web], just like any
other extension. See the web engine guide.
Compatibility and local development
Use the same Day source/version for the application and extension. To work on both checkouts, apply local Cargo patches at the consuming workspace root; do not compile a second copy of Day’s model/reactive crates. See the extension’s README for setup and validation.