diff --git a/README.md b/README.md index 5070f2e9f..c33cc8c25 100644 --- a/README.md +++ b/README.md @@ -576,6 +576,12 @@ rockhopper --config rockhopper_sqlite.yaml up rockhopper --config rockhopper_mysql.yaml up ``` +Then run the following command to compile the migration files into go files: + +```shell +make migrations +``` + ### Setup frontend development environment ```sh diff --git a/migrations/mysql/20210531234123_add_kline_taker_buy_columns.sql b/migrations/mysql/20210531234123_add_kline_taker_buy_columns.sql new file mode 100644 index 000000000..ece9e8be0 --- /dev/null +++ b/migrations/mysql/20210531234123_add_kline_taker_buy_columns.sql @@ -0,0 +1,35 @@ +-- +up +-- +begin +ALTER TABLE `binance_klines` + ADD COLUMN `taker_buy_base_volume` DECIMAL(16, 8) NOT NULL DEFAULT 0.0, + ADD COLUMN `taker_buy_quote_volume` DECIMAL(16, 8) NOT NULL DEFAULT 0.0; +-- +end +-- +begin +ALTER TABLE `max_klines` + ADD COLUMN `taker_buy_base_volume` DECIMAL(16, 8) NOT NULL DEFAULT 0.0, + ADD COLUMN `taker_buy_quote_volume` DECIMAL(16, 8) NOT NULL DEFAULT 0.0; +-- +end +-- +begin +ALTER TABLE `okex_klines` + ADD COLUMN `taker_buy_base_volume` DECIMAL(16, 8) NOT NULL DEFAULT 0.0, + ADD COLUMN `taker_buy_quote_volume` DECIMAL(16, 8) NOT NULL DEFAULT 0.0; +-- +end + +-- +down +-- +begin +ALTER TABLE `binance_klines` + DROP COLUMN `taker_buy_base_volume`, + DROP COLUMN `taker_buy_quote_volume`; +-- +end + +-- +begin +ALTER TABLE `max_klines` + DROP COLUMN `taker_buy_base_volume`, + DROP COLUMN `taker_buy_quote_volume`; +-- +end + +-- +begin +ALTER TABLE `okex_klines` + DROP COLUMN `taker_buy_base_volume`, + DROP COLUMN `taker_buy_quote_volume`; +-- +end diff --git a/migrations/sqlite3/20210531234123_add_kline_taker_buy_columns.sql b/migrations/sqlite3/20210531234123_add_kline_taker_buy_columns.sql new file mode 100644 index 000000000..d7ff4e671 --- /dev/null +++ b/migrations/sqlite3/20210531234123_add_kline_taker_buy_columns.sql @@ -0,0 +1,10 @@ +-- +up +-- +begin +SELECT 'up SQL query'; +-- +end + +-- +down + +-- +begin +SELECT 'down SQL query'; +-- +end diff --git a/pkg/types/kline.go b/pkg/types/kline.go index 5bda60b1e..c0ea0357d 100644 --- a/pkg/types/kline.go +++ b/pkg/types/kline.go @@ -61,8 +61,8 @@ type KLine struct { Low float64 `json:"low" db:"low"` Volume float64 `json:"volume" db:"volume"` QuoteVolume float64 `json:"quoteVolume" db:"quote_volume"` - TakerBuyBaseAssetVolume float64 `json:"takerBuyBaseAssetVolume"` - TakerBuyQuoteAssetVolume float64 `json:"takerBuyQuoteAssetVolume"` + TakerBuyBaseAssetVolume float64 `json:"takerBuyBaseAssetVolume" db:"taker_buy_base_volume"` + TakerBuyQuoteAssetVolume float64 `json:"takerBuyQuoteAssetVolume" db:"taker_buy_quote_volume"` LastTradeID uint64 `json:"lastTradeID" db:"last_trade_id"` NumberOfTrades uint64 `json:"numberOfTrades" db:"num_trades"`