Skip to main content

siderite_migrations/
lib.rs

1//! Django-inspired schema migrations for siderite.
2//!
3//! * [`state`] — serializable snapshots built from [`siderite_orm::ModelMeta`].
4//! * [`operation`] — `CreateModel`, `AddField`, `RunSQL`, …
5//! * [`autodetector`] — deterministic [`autodetector::diff`].
6//! * [`schema_editor`] — PostgreSQL / SQLite / MySQL DDL.
7//! * [`loader`] / [`migration`] — JSON files, dependency graph, checksums.
8//! * [`executor::Migrator`] — history table, migrate / rollback / dry-run.
9//! * [`cli::run`] — the five management commands, called from the app binary.
10//!
11//! See `docs/MIGRATIONS.md` for the file format, reversibility table and
12//! SQLite rebuild caveat.
13
14#![forbid(unsafe_code)]
15
16pub mod autodetector;
17pub mod cli;
18pub mod error;
19pub mod executor;
20mod hash;
21pub mod loader;
22pub mod migration;
23pub mod operation;
24pub mod registry;
25pub mod schema_editor;
26pub mod squash;
27pub mod state;
28
29pub use autodetector::{RenameHints, diff, diff_with};
30pub use cli::{ExitCode, make_migrations, run};
31pub use error::MigrationError;
32pub use executor::LockHolder;
33pub use executor::{
34    HISTORY_TABLE, MigrationIntent, Migrator, RecoveryEntry, RecoveryReport, Report,
35};
36pub use loader::{MigrationGraph, load_dir, write_migration};
37pub use migration::Migration;
38pub use operation::Operation;
39pub use registry::MigrationRegistry;
40pub use state::{
41    ConstraintState, DbDefault, FieldState, ForeignKeyState, IndexState, ModelState, OnDelete,
42    ProjectState, SqlType,
43};