From 603b0ef832ee1a4d058931bbb7dca8585e6934cf Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Fri, 28 Jan 2022 20:24:09 +0800 Subject: [PATCH] Update README --- sea-orm-cli/README.md | 45 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/sea-orm-cli/README.md b/sea-orm-cli/README.md index bcf49100b..af7f1dd3f 100644 --- a/sea-orm-cli/README.md +++ b/sea-orm-cli/README.md @@ -6,7 +6,7 @@ Getting Help: cargo run -- -h ``` -Running Entity Generator: +## Running Entity Generator: ```sh # MySQL (`--database-schema` option is ignored) @@ -18,3 +18,46 @@ 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 + ```sh + cargo run -- migrate init + ``` +- Apply all pending migrations + ```sh + cargo run -- migrate + ``` + ```sh + cargo run -- migrate up + ``` +- Apply first 10 pending migrations + ```sh + cargo run -- migrate up -n 10 + ``` +- Rollback last applied migrations + ```sh + cargo run -- migrate down + ``` +- Rollback last 10 applied migrations + ```sh + cargo run -- migrate down -n 10 + ``` +- Drop all tables from the database, then reapply all migrations + ```sh + cargo run -- migrate fresh + ``` +- Rollback all applied migrations, then reapply all migrations + ```sh + cargo run -- migrate refresh + ``` +- Rollback all applied migrations + ```sh + cargo run -- migrate reset + ``` +- Check the status of all migrations + ```sh + cargo run -- migrate status + ``` +