Running Migrator CLI
- Generate a new migration file
- Apply all pending migrations
- Apply first 10 pending migrations
- Rollback last applied migrations
- Rollback last 10 applied migrations
- Drop all tables from the database, then reapply all migrations
- Rollback all applied migrations, then reapply all migrations
- Rollback all applied migrations
- Check the status of all migrations
Changing database scheme
- Change
src/iden.rs. - Create new migration under
src/m20220101_00000XX_create_table.rs. - Add the migration in
src/lib.rs. - Apply migration (on postgres, sqlite will give wrong types in the
autogenerated entities, application by
cargo runinmigrationdirectory may fail, while running the wholekellnrsucceeds). - Generate new entities running
sea-orm-cli generate entity -u postgresql://admin:admin@127.0.0.1/kellnr_dbpostgresql://admin:admin@127.0.0.1/kellnr_db(adjust this command appropriately) in thesrc/m20220101_00000XX_create_table_entitiesdirectory. - Copy entities to
../entity/src(mod.rsshall go tolib.rs).