oxide_sql_core/migrations/introspect.rs
1//! Schema introspection trait.
2//!
3//! Driver crates (oxide-sql-sqlite, etc.) implement [`Introspect`]
4//! to read the current database schema at runtime. The core crate
5//! defines only the trait so it stays driver-agnostic.
6
7use super::snapshot::SchemaSnapshot;
8
9/// Introspects a live database connection to produce a
10/// [`SchemaSnapshot`] of the current schema.
11///
12/// Implementations live in driver crates (e.g. oxide-sql-sqlite).
13pub trait Introspect {
14 /// Error type for introspection failures.
15 type Error: std::error::Error;
16
17 /// Reads the current database schema and returns a snapshot.
18 fn introspect_schema(&self) -> Result<SchemaSnapshot, Self::Error>;
19}