Database Sandbox File
SQLite-compatible database file residing inside your app container or shared App Group.
Type-Safe Models
Swift structs using
@Table and @BoutiqueTable macros with StructuredQueries.DatabaseActor Concurrency
All engine I/O runs safely off the main thread via
@MainActor and background actors.CDC Live Queries
Automated UI state updates backed by Change Data Capture tokens.
1. The Database File
A BoutiqueDB database is a regular SQLite-compatible file on disk. You select its location using helper methods:URL
required
Target disk URL. Supported locations include:
BoutiqueDB.applicationSupportURL(): Default persistent data sandbox.BoutiqueDB.documentsURL(): User-accessible documents directory.BoutiqueDB.inMemoryURL(): In-memory store for Xcode Previews and tests.- App Group Container: Shared database file when
multiProcess: trueis set.
2. Models (@Table and @BoutiqueTable)
Models are standard Swift structs. StructuredQueries provides @Table for type-safe query generation, while BoutiqueDB provides @BoutiqueTable for Turso-specific table options.
Model Capabilities:
@Table exposes Note.all, Note.where { ... }, Note.insert, Note.update, and Codable decoding. @BoutiqueTable adds STRICT, WITHOUT ROWID, and generated columns.3. Schema Migrations
Migrations in BoutiqueDB are explicit, named, and append-only:4. Isolation & Concurrency Safety
All database read and write operations are routed through isolation guards:5. CDC Live Queries
LiveQuery and LiveQueryOne property wrappers subscribe to database change tokens (turso_cdc) and trigger view invalidation automatically:
6. Error Handling
BoutiqueDB surfaces strongly-typed errors viaBoutiqueError:

