add klines columns

This commit is contained in:
c9s 2021-05-31 23:46:53 +08:00
parent 507ae934c0
commit 4bec8984c0
4 changed files with 53 additions and 2 deletions

View File

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

View File

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

View File

@ -0,0 +1,10 @@
-- +up
-- +begin
SELECT 'up SQL query';
-- +end
-- +down
-- +begin
SELECT 'down SQL query';
-- +end

View File

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