770 B · text History 25c4237

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

  1. Create src/mYYYYMMDD_NNNNNN_your_change.rs (copy an existing one).

  2. Register it in src/lib.rs.

  3. After the schema settles, regenerate the entities in the parent crate:

    sea-orm-cli generate entity -u "$DATABASE_URL" -o ../src/entities