kellnr-migration

Crates.iokellnr-migration
lib.rskellnr-migration
version5.14.0
created_at2026-01-11 19:04:45.393912+00
updated_at2026-01-24 19:24:16.64466+00
descriptionKellnr is a self-hosted registry for Rust crates with support for rustdocs and crates.io caching.
homepagehttps://kellnr.io/
repositoryhttps://github.com/kellnr/kellnr
max_upload_size
id2036247
size541,476
Stefan Hausotte (secana)

documentation

https://kellnr.io/documentation

README

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).
Commit count: 1718

cargo fmt