Skip to main content

khive_db/backend/
schema_readiness.rs

1use super::*;
2
3impl StorageBackend {
4    /// Validate the sealed memory-receipt cutover without a writer or migration.
5    pub fn validate_memory_visibility_cutover(&self) -> Result<(), SqliteError> {
6        let reader = self.pool.reader()?;
7        crate::migrations::validate_memory_visibility_cutover(reader.conn())
8    }
9
10    /// Read the applied schema version through the pool's ordinary reader or
11    /// writer, without running migrations. Unlike
12    /// [`migrations::inspect_schema_version`](crate::migrations::inspect_schema_version),
13    /// this goes through the already-open pool rather than a fresh boot-time
14    /// snapshot connection, so it tolerates a WAL sidecar left by this same
15    /// backend's own recent writes.
16    pub fn schema_version(&self) -> Result<u32, SqliteError> {
17        let reader = self.pool.reader()?;
18        crate::migrations::read_schema_version(reader.conn())
19    }
20}