Generating migrations
Using sea-orm, we follow the standard migration-first approach. We recommend using sea-orm-cli to generate migrations and entities.
Migrations
To create a new migration file, navigate to the crates folder and run
backend/crates $ sea-orm-cli migrate generate MIGRATION_NAMETo migrate the database, follow the steps in SETUP.md or for short, run
backend/crates/voting-app $ cargo run(PostgreSQL is managed automatically by devenv when you enter the shell.)
Entities
Generating entities requires the database to be migrated, so that the entities can be built off the structure of the database. After migrating the database, run either
backend/crates/entity/src $ sea-orm-cli generate entityor
backend/crates $ sea-orm-cli generate entity -o entity/src