pub struct SqliteAdapter { /* private fields */ }Implementations§
Source§impl SqliteAdapter
impl SqliteAdapter
Sourcepub fn open(path: &str) -> Result<Self, StorageError>
pub fn open(path: &str) -> Result<Self, StorageError>
Open or create a SQLite database at the given path.
Sourcepub fn in_memory() -> Result<Self, StorageError>
pub fn in_memory() -> Result<Self, StorageError>
Create an in-memory SQLite database.
Source§impl SqliteAdapter
impl SqliteAdapter
Sourcepub fn plan_from_live(
&self,
target: &AppManifest,
) -> Result<SchemaPlan, StorageError>
pub fn plan_from_live( &self, target: &AppManifest, ) -> Result<SchemaPlan, StorageError>
Plan schema changes by comparing the live DB state against the target manifest. Only plans additive operations: CreateEntity, AddField, AddIndex.
Source§impl SqliteAdapter
impl SqliteAdapter
Sourcepub fn apply_with_history(
&self,
plan: &SchemaPlan,
meta: &PushMetadata<'_>,
) -> Result<(), StorageError>
pub fn apply_with_history( &self, plan: &SchemaPlan, meta: &PushMetadata<'_>, ) -> Result<(), StorageError>
Apply a schema plan and record the push in the history table — atomically. If either the DDL or the history INSERT fails, the whole transaction rolls back so the database never ends up with a schema change that has no history row, or a history row that points at a failed migration.
Sourcepub fn read_history(
&self,
limit: Option<u32>,
) -> Result<Vec<HistoryEntry>, StorageError>
pub fn read_history( &self, limit: Option<u32>, ) -> Result<Vec<HistoryEntry>, StorageError>
Read schema push history, newest-first. Returns empty vec if the history table does not exist.
Sourcepub fn read_history_entry(
&self,
entry_id: &str,
) -> Result<Option<HistoryEntry>, StorageError>
pub fn read_history_entry( &self, entry_id: &str, ) -> Result<Option<HistoryEntry>, StorageError>
Read a single history entry by ID. Returns None if the history table doesn’t exist or the ID is not found.
Source§impl SqliteAdapter
impl SqliteAdapter
Sourcepub fn read_schema(&self) -> Result<SchemaSnapshot, StorageError>
pub fn read_schema(&self) -> Result<SchemaSnapshot, StorageError>
Read the current schema from the live SQLite database. Only inspects user tables (not sqlite_* internal tables).