fix #288 for adding migration

This commit is contained in:
TonyQ 2021-12-04 02:05:02 +00:00
parent 543ac84c27
commit 93611c46eb
3 changed files with 39 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,8 @@
-- +up
-- +begin
-- +end
-- +down
-- +begin
-- +end