Expand description
Declarative schema system and migration file generator for yauth.
This crate has zero ORM dependencies — it is a pure code generator. It provides:
- Schema types (
TableDef,ColumnDef,ColumnType, etc.) - Core + plugin schema definitions
- Schema collector with topological sort by FK dependencies
- Dialect-specific DDL generators (Postgres, SQLite, MySQL)
- Schema diff engine for incremental migrations
- Migration file generators (diesel up.sql/down.sql, sqlx numbered .sql)
yauth.tomlconfig file support- Schema hash for tracking
Modules§
- config
yauth.tomlconfiguration file support.- diff
- Schema diff engine.
- generate
- Migration file generators for diesel and sqlx.
- plugin_
schemas - Schema definitions for each built-in plugin.
Structs§
- Column
Def - Definition of a single column.
- Foreign
Key - Foreign key reference from a column to another table’s column.
- Index
Def - Index definition for a table.
- Table
Def - Definition of a single table.
- YAuth
Schema - Merged schema: all tables topologically sorted by FK dependencies.
Enums§
- Column
Type - Abstract column type – each dialect maps this to a concrete SQL type.
- Dialect
- Supported SQL dialects for DDL generation.
- OnDelete
- ON DELETE action for foreign keys.
- Orm
- Supported ORM formats for migration file generation.
- Schema
Error - Error during schema collection.
Constants§
- ALL_
PLUGINS - All known plugin names.
Functions§
- collect_
schema - Collect and merge core + plugin schemas, then topologically sort by FK deps.
- collect_
schema_ for_ plugins - Collect a schema from a list of plugin names plus core tables.
- core_
schema - Returns the core yauth tables: users, sessions, audit_log.
- generate_
ddl - Generate DDL for a schema in the given dialect.
- generate_
diesel_ schema - Generate diesel
table!macro definitions as Rust source text. - generate_
mysql_ ddl - Generate complete MySQL DDL for the entire schema.
- generate_
mysql_ drop - Generate DROP TABLE IF EXISTS statement for a single table (MySQL).
- generate_
mysql_ drops - Generate DROP TABLE statements for a list of tables in reverse order (MySQL).
- generate_
postgres_ ddl - Generate complete Postgres DDL for the entire schema.
- generate_
postgres_ drop - Generate a DROP TABLE IF EXISTS statement for a single table.
- generate_
postgres_ drops - Generate DROP TABLE statements for a list of tables in reverse order.
- generate_
sqlite_ ddl - Generate complete SQLite DDL for the entire schema.
- generate_
sqlite_ drop - Generate DROP TABLE IF EXISTS statement for a single table (SQLite).
- generate_
sqlite_ drops - Generate DROP TABLE statements for a list of tables in reverse order (SQLite).
- is_
known_ plugin - Check if a plugin name is valid (even if it has no database tables).
Plugins like
admin,status,telemetry, andopenapiare code-only. - plugin_
schema_ by_ name - Get the schema tables for a plugin by name.
- schema_
hash - Compute a deterministic hash of the schema for tracking purposes.