diff --git a/README.md b/README.md index 24c95f8d7..f30d47413 100644 --- a/README.md +++ b/README.md @@ -566,6 +566,12 @@ The overview function flow at bbgo ### Adding new migration +1. The project used rockerhopper for db migration. +https://github.com/c9s/rockhopper + + +2. Create migration files + ```sh rockhopper --config rockhopper_sqlite.yaml create --type sql add_pnl_column rockhopper --config rockhopper_mysql.yaml create --type sql add_pnl_column @@ -577,9 +583,11 @@ or bash utils/generate-new-migration.sh add_pnl_column ``` -Be sure to edit both sqlite3 and mysql migration files. +Be sure to edit both sqlite3 and mysql migration files. ( [Sample] (migrations/mysql/20210531234123_add_kline_taker_buy_columns.sql) ) -To test the drivers, you can do: + +To test the drivers, you have to update the rockhopper_mysql.yaml file to connect your database, +then do: ```sh rockhopper --config rockhopper_sqlite.yaml up diff --git a/migrations/mysql/20211204014905_update_taker_buy_base_volumn.sql b/migrations/mysql/20211204014905_update_taker_buy_base_volumn.sql new file mode 100644 index 000000000..15d236a03 --- /dev/null +++ b/migrations/mysql/20211204014905_update_taker_buy_base_volumn.sql @@ -0,0 +1,21 @@ +-- +up +-- +begin +ALTER TABLE binance_klines CHANGE taker_buy_base_volume taker_buy_base_volume decimal(32,8) NOT NULL; +-- +end +-- +begin +ALTER TABLE max_klines CHANGE taker_buy_base_volume taker_buy_base_volume decimal(32,8) NOT NULL; +-- +end +-- +begin +ALTER TABLE okex_klines CHANGE taker_buy_base_volume taker_buy_base_volume decimal(32,8) NOT NULL; +-- +end + +-- +down +-- +begin +ALTER TABLE binance_klines CHANGE taker_buy_base_volume taker_buy_base_volume decimal(16,8) NOT NULL; +-- +end +-- +begin +ALTER TABLE max_klines CHANGE taker_buy_base_volume taker_buy_base_volume decimal(16,8) NOT NULL; +-- +end +-- +begin +ALTER TABLE okex_klines CHANGE taker_buy_base_volume taker_buy_base_volume decimal(16,8) NOT NULL; +-- +end diff --git a/migrations/sqlite3/20211204014905_update_taker_buy_base_volumn.sql b/migrations/sqlite3/20211204014905_update_taker_buy_base_volumn.sql new file mode 100644 index 000000000..a88ad32d4 --- /dev/null +++ b/migrations/sqlite3/20211204014905_update_taker_buy_base_volumn.sql @@ -0,0 +1,8 @@ +-- +up +-- +begin +-- +end + +-- +down + +-- +begin +-- +end