Skip to main content

gaman_core/
lib.rs

1//! Core schema modeling, lexical diffing, semantic drift, migration planning,
2//! replay, clarification, and SQL rendering primitives.
3//!
4//! Gaman works with three schema sources: authored input, replayed migration
5//! state, and live inspected state. Authored input is normalized and lexically
6//! diffed against replayed state to generate migrations. Live inspected state is
7//! normalized through the selected dialect and semantically drift-diffed against
8//! replayed state using dialect comparator callbacks.
9//!
10//! ```text
11//! input Schema -> normalize + prepare(dialect)
12//!                         |
13//! replayed Schema --------+-> DiffEngine -> raw operations -> Clarifier -> Migration
14//!
15//! inspected Schema -> normalize_inspected_schema(dialect)
16//!                         |
17//! replayed Schema --------+-> drift::diff -> VerificationReport
18//!
19//! VerificationReport -> repair::plan_repair -> repair operations -> SQL
20//!
21//! Migration replay -> prepare(dialect) -> SqlPlanRenderer + Dialect -> SQL
22//! ```
23//!
24//! `parsers` loads SQL DDL into `Schema`; `offline_planner` owns offline
25//! generation; `drift` owns semantic live drift reports; `repair` owns
26//! database-I/O-free drift repair planning; `sql_plan` renders forward,
27//! rollback, and repair SQL from migrations.
28
29pub mod clarifier;
30pub mod column_type;
31pub mod dialects;
32pub mod diff;
33pub mod drift;
34pub mod graphs;
35pub mod migrations;
36pub mod operations;
37pub mod parsers;
38pub mod repair;
39pub mod replay;
40#[doc(hidden)]
41pub mod sql_plan;
42pub mod states;
43
44mod offline_planner;
45mod opaque;
46
47pub use dialects::{Dialect, DialectError};
48pub use migrations::Migration;
49pub use offline_planner::{EmbeddedMigrations, OfflineError, OfflinePlanner};
50
51pub mod schema {
52    pub use crate::column_type::{ColumnDesc, ColumnType};
53    pub use crate::operations::Operation;
54    pub use crate::parsers::ParseError;
55    pub use crate::states::{
56        Column, ColumnBuilder, ColumnRef, Constraint, ConstraintInput, EnumDef, EnumInput,
57        ExtensionDef, ExtensionInput, ForeignKey, FunctionDef, FunctionInput, Index, IndexInput,
58        InputSchema, IntoTable, PrimaryKey, ReplayError, Schema, SchemaBuilder, SchemaLoadError,
59        SchemaValidationError, Table, TableBuilder, TableInput, TriggerDef, TriggerEvent,
60        TriggerInput, TriggerScope, TriggerTiming, ViewDef, ViewInput, Volatility, is_volatile,
61        schema_qualified_key,
62    };
63}