Skip to main content

fse_schema/
lib.rs

1//! fse-schema — the shared schema layer of the fse ORM.
2//!
3//! One schema model with three consumers:
4//! - `fse-orm-macros` parses a single `#[derive(Table)]` struct into a
5//!   [`TableDef`] to generate compile-time-checked sqlx queries,
6//! - `fse-cli` parses the whole tables folder into a [`Schema`], diffs it
7//!   against the committed snapshot and emits plain sqlx migration files,
8//! - the snapshot file (`.fse/schema.json`) is just this model as JSON.
9//!
10//! Nothing in this crate knows about any concrete application: table names,
11//! column names and constraints all come from the parsed structs.
12
13pub mod diff;
14pub mod model;
15pub mod parse;
16pub mod snapshot;
17pub mod sql;
18
19mod error;
20
21pub use diff::{Migration, diff_schemas};
22pub use error::Error;
23pub use model::{
24    ColumnDef, DefaultValue, EnumDef, ForeignKey, OnDelete, RelationDef, Schema, SqlType, TableDef,
25};