34 releases (10 breaking)

new 0.11.0-rc.1 Feb 2, 2023
0.10.6 Dec 17, 2022
0.10.5 Nov 24, 2022
0.9.1 Jul 14, 2022
0.4.0 Nov 19, 2021

#3 in #async-orm

Download history 2417/week @ 2022-10-13 3257/week @ 2022-10-20 2547/week @ 2022-10-27 2863/week @ 2022-11-03 3144/week @ 2022-11-10 2673/week @ 2022-11-17 2706/week @ 2022-11-24 3031/week @ 2022-12-01 2832/week @ 2022-12-08 2867/week @ 2022-12-15 2540/week @ 2022-12-22 2779/week @ 2022-12-29 3687/week @ 2023-01-05 3231/week @ 2023-01-12 3863/week @ 2023-01-19 3420/week @ 2023-01-26

14,857 downloads per month
Used in 15 crates (via sea-orm-migration)

MIT/Apache

79KB
2K 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

~11–21MB
~360K SLoC