mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
fix #288 for adding migration
This commit is contained in:
parent
d2ac378b30
commit
2abae8681d
12
README.md
12
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
|
||||
|
|
|
@ -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
|
|
@ -0,0 +1,8 @@
|
|||
-- +up
|
||||
-- +begin
|
||||
-- +end
|
||||
|
||||
-- +down
|
||||
|
||||
-- +begin
|
||||
-- +end
|
Loading…
Reference in New Issue
Block a user