Expand description
Shared helpers for emitting SeaORM migration files that call the
doido_model::migration builders (create_table, alter_table,
drop_table, add_index, …) instead of raw sea-orm boilerplate.
Used by both the model generator (which creates a table for a new model) and the migration generator.
Constants§
- MIGRATION_
LIB_ BASE - Fallback migration
lib.rsused when the app doesn’t have one on disk yet; kept in sync with the generated-app template so injection markers line up. - MIGRATION_
SRC_ DIR - Directory holding the SeaORM migration crate’s sources.
Functions§
- create_
table_ imports - The
doido_model::migrationimport line for acreate_tablemigration — pulls inadd_indexonly when a field requested an index, so generated code carries no unused imports. - create_
table_ up - Builds the
up()body for acreate_tablemigration — acreate_tablecall carrying the declared columns, followed by anyadd_indexcalls for:indexfields. - drop_
table_ down - The
down()body that drops a table:drop_table(manager, "<table>").await. - register_
migration - Inserts a
mod <module>;declaration and aBox::new(<module>::Migration)registration into the migration crate’slib.rs, just above the generator markers. Indentation of the list entry mirrors the marker line. - render_
migration_ file - Renders a full migration file from the imports line and the
up/downbodies (each already indented as anasync fnbody ending in a newline).