Skip to main content

sync_and_migrate

Function sync_and_migrate 

Source
pub async fn sync_and_migrate(db: &DbPool) -> Result<(), Error>
Expand description

Synchronize database schema from all registered entities, then run all pending migrations.

  1. Bootstrap _modo_migrations table (must exist before schema sync)
  2. Collect all EntityRegistration entries from inventory
  3. Register framework entities first, then user entities
  4. Run SchemaBuilder::sync() (addition-only, topo-sorted by SeaORM)
  5. Execute extra SQL (composite indices, partial unique indices)
  6. Run pending migrations (version-ordered, tracked in _modo_migrations)