Migrations
SeaORM migrations. The webservice runs pending migrations on boot by default
(AUTO_MIGRATE=true), so you rarely need these directly. To run them manually:
# Apply all pending migrations
cargo run -p migration -- up
# Roll back the last migration
cargo run -p migration -- down
# Fresh (drop everything and re-apply)
cargo run -p migration -- fresh
DATABASE_URL must point at your Postgres instance (see the root compose.yml
for the local default).
Adding a migration
-
Create
src/mYYYYMMDD_NNNNNN_your_change.rs(copy an existing one). -
Register it in
src/lib.rs. -
After the schema settles, regenerate the entities in the parent crate:
sea-orm-cli generate entity -u "$DATABASE_URL" -o ../src/entities