First, we need to install Sea-ORM CLI,
cargo install sea-orm-cliYou can also specify the version you want to install. In my case, the above command installed v1.0.0 of the CLI. To
install the same version as mine, type in the following,
cargo install sea-orm-cli@1.0.0This will install v1.0.0 instead of the latest release. Any CLI operation mentioned in this post will be with this
version of the Sea-ORM CLI.
Now we will add two migration crate. As the name suggests, migration will hold the the migrations for our models.
To create the migration crate, type in the following command from within your project directory,
sea-orm-cli migrate initThis will create a migration crate and should look like this,
migration
├── Cargo.toml
├── README.md
└── src
├── lib.rs
├── m20220101_000001_create_table.rs
└── main.rsWe are now done with our Sea-ORM setup. Now let's test it by adding a User model.