kellnr-migration 5.10.0

Kellnr is a self-hosted registry for Rust crates with support for rustdocs and crates.io caching.
docs.rs failed to build kellnr-migration-5.10.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: kellnr-migration-6.4.0

Running Migrator CLI

  • Generate a new migration file
    cargo run -- generate MIGRATION_NAME
    
  • Apply all pending migrations
    cargo run
    
    cargo run -- up
    
  • Apply first 10 pending migrations
    cargo run -- up -n 10
    
  • Rollback last applied migrations
    cargo run -- down
    
  • Rollback last 10 applied migrations
    cargo run -- down -n 10
    
  • Drop all tables from the database, then reapply all migrations
    cargo run -- fresh
    
  • Rollback all applied migrations, then reapply all migrations
    cargo run -- refresh
    
  • Rollback all applied migrations
    cargo run -- reset
    
  • Check the status of all migrations
    cargo run -- status
    

Changing database scheme

  1. Change src/iden.rs.
  2. Create new migration under src/m20220101_00000XX_create_table.rs.
  3. Add the migration in src/lib.rs.
  4. Apply migration (on postgres, sqlite will give wrong types in the autogenerated entities, application by cargo run in migration directory may fail, while running the whole kellnr succeeds).
  5. 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 the src/m20220101_00000XX_create_table_entities directory.
  6. Copy entities to ../entity/src (mod.rs shall go to lib.rs).