53 releases

1.0.0-rc.1 Feb 6, 2024
0.12.14 Feb 5, 2024
0.12.12 Jan 22, 2024
0.12.10 Dec 14, 2023
0.4.0 Nov 19, 2021

#1723 in Database interfaces

Download history 27917/week @ 2023-11-01 23840/week @ 2023-11-08 31043/week @ 2023-11-15 31706/week @ 2023-11-22 29040/week @ 2023-11-29 25869/week @ 2023-12-06 28445/week @ 2023-12-13 27534/week @ 2023-12-20 15362/week @ 2023-12-27 22694/week @ 2024-01-03 25245/week @ 2024-01-10 27585/week @ 2024-01-17 32249/week @ 2024-01-24 27798/week @ 2024-01-31 28680/week @ 2024-02-07 19104/week @ 2024-02-14

113,255 downloads per month
Used in 15 crates (via sea-orm-migration)

MIT/Apache

94KB
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

~16–33MB
~460K SLoC