#orm #async #mysql #postgresql

bin+lib sea-orm-cli

Command line utility for SeaORM

127 releases (23 stable)

Uses new Rust 2024

2.0.0-rc.40 May 30, 2026
2.0.0-rc.37 Mar 9, 2026
2.0.0-rc.27 Dec 30, 2025
2.0.0-rc.19 Nov 23, 2025
0.4.0 Nov 19, 2021

#241 in #mysql

Download history 16318/week @ 2026-03-03 122429/week @ 2026-03-10 96325/week @ 2026-03-17 111537/week @ 2026-03-24 106744/week @ 2026-03-31 148029/week @ 2026-04-07 139197/week @ 2026-04-14 123774/week @ 2026-04-21 151921/week @ 2026-04-28 161324/week @ 2026-05-05 136179/week @ 2026-05-12 173197/week @ 2026-05-19 150038/week @ 2026-05-26 166208/week @ 2026-06-02

650,971 downloads per month
Used in 157 crates (2 directly)

MIT/Apache

130KB
3K SLoC

SeaORM CLI

Install and Usage:

> cargo install sea-orm-cli 
> sea-orm-cli help

Or:

> cargo install --bin sea
> sea help

Getting Help:

cargo run -- -h

Running Entity Generator:

# MySQL (`--database-schema` option is ignored)
cargo run -- generate entity -u mysql://sea:sea@localhost/bakery -o out

# SQLite (`--database-schema` option is ignored)
cargo run -- generate entity -u sqlite://bakery.db -o out

# PostgreSQL
cargo run -- generate entity -u postgres://sea:sea@localhost/bakery -s public -o out

Running Migration:

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

Dependencies

~10–23MB
~350K SLoC