From 1118453b9637b02333e7dbe497b7511e185276e7 Mon Sep 17 00:00:00 2001 From: TonyQ Date: Sat, 11 Dec 2021 10:40:57 +0800 Subject: [PATCH] doc: update readme document for migration --- README.md | 8 ++++++++ .../mysql/20211211103657_update_fee_currency_length.sql | 9 +++++++++ .../20211211103657_update_fee_currency_length.sql | 8 ++++++++ 3 files changed, 25 insertions(+) create mode 100644 migrations/mysql/20211211103657_update_fee_currency_length.sql create mode 100644 migrations/sqlite3/20211211103657_update_fee_currency_length.sql diff --git a/README.md b/README.md index be2696f24..e3d7fd9e5 100644 --- a/README.md +++ b/README.md @@ -562,6 +562,14 @@ Then run the following command to compile the migration files into go files: make migrations ``` +or + +```shell + rockhopper compile --config rockhopper_mysql.yaml --output pkg/migrations/mysql + rockhopper compile --config rockhopper_sqlite.yaml --output pkg/migrations/sqlite3 + git add -v pkg/migrations && git commit -m "compile and update migration package" pkg/migrations || true +``` + If you want to override the DSN and the Driver defined in the YAML config file, you can add some env vars in your dotenv file like this: diff --git a/migrations/mysql/20211211103657_update_fee_currency_length.sql b/migrations/mysql/20211211103657_update_fee_currency_length.sql new file mode 100644 index 000000000..89bda824b --- /dev/null +++ b/migrations/mysql/20211211103657_update_fee_currency_length.sql @@ -0,0 +1,9 @@ +-- +up +-- +begin +ALTER TABLE trades CHANGE fee_currency fee_currency varchar(10) NOT NULL; +-- +end + +-- +down +-- +begin +ALTER TABLE trades CHANGE fee_currency fee_currency varchar(4) NOT NULL; +-- +end diff --git a/migrations/sqlite3/20211211103657_update_fee_currency_length.sql b/migrations/sqlite3/20211211103657_update_fee_currency_length.sql new file mode 100644 index 000000000..a88ad32d4 --- /dev/null +++ b/migrations/sqlite3/20211211103657_update_fee_currency_length.sql @@ -0,0 +1,8 @@ +-- +up +-- +begin +-- +end + +-- +down + +-- +begin +-- +end