migrations: clean up and add kucoin klines table

This commit is contained in:
c9s 2021-12-26 02:30:45 +08:00
parent 1da0c8e755
commit ce07c3eda4
6 changed files with 49 additions and 39 deletions

View File

@ -1,21 +1,21 @@
-- +up -- +up
-- +begin -- +begin
ALTER TABLE `binance_klines` ALTER TABLE `binance_klines`
ADD COLUMN `quote_volume` DECIMAL(32, 4) NOT NULL DEFAULT 0.0, ADD COLUMN `quote_volume` DECIMAL(32, 8) NOT NULL DEFAULT 0.0,
ADD COLUMN `taker_buy_base_volume` DECIMAL(16, 8) NOT NULL DEFAULT 0.0, ADD COLUMN `taker_buy_base_volume` DECIMAL(32, 8) NOT NULL DEFAULT 0.0,
ADD COLUMN `taker_buy_quote_volume` DECIMAL(32, 4) NOT NULL DEFAULT 0.0; ADD COLUMN `taker_buy_quote_volume` DECIMAL(32, 8) NOT NULL DEFAULT 0.0;
-- +end -- +end
-- +begin -- +begin
ALTER TABLE `max_klines` ALTER TABLE `max_klines`
ADD COLUMN `quote_volume` DECIMAL(32, 4) NOT NULL DEFAULT 0.0, ADD COLUMN `quote_volume` DECIMAL(32, 8) NOT NULL DEFAULT 0.0,
ADD COLUMN `taker_buy_base_volume` DECIMAL(16, 8) NOT NULL DEFAULT 0.0, ADD COLUMN `taker_buy_base_volume` DECIMAL(32, 8) NOT NULL DEFAULT 0.0,
ADD COLUMN `taker_buy_quote_volume` DECIMAL(32, 4) NOT NULL DEFAULT 0.0; ADD COLUMN `taker_buy_quote_volume` DECIMAL(32, 8) NOT NULL DEFAULT 0.0;
-- +end -- +end
-- +begin -- +begin
ALTER TABLE `okex_klines` ALTER TABLE `okex_klines`
ADD COLUMN `quote_volume` DECIMAL(32, 4) NOT NULL DEFAULT 0.0, ADD COLUMN `quote_volume` DECIMAL(32, 8) NOT NULL DEFAULT 0.0,
ADD COLUMN `taker_buy_base_volume` DECIMAL(16, 8) NOT NULL DEFAULT 0.0, ADD COLUMN `taker_buy_base_volume` DECIMAL(32, 8) NOT NULL DEFAULT 0.0,
ADD COLUMN `taker_buy_quote_volume` DECIMAL(32, 4) NOT NULL DEFAULT 0.0; ADD COLUMN `taker_buy_quote_volume` DECIMAL(32, 8) NOT NULL DEFAULT 0.0;
-- +end -- +end
-- +down -- +down

View File

@ -1,21 +0,0 @@
-- +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,10 @@
-- +up
-- +begin
CREATE TABLE `kucoin_klines` LIKE `binance_klines`;
-- +end
-- +down
-- +begin
DROP TABLE `kucoin_klines`;
-- +end

View File

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

View File

@ -26,5 +26,5 @@ CREATE TABLE `ftx_klines`
-- +down -- +down
-- +begin -- +begin
drop table ftx_klines; DROP TABLE ftx_klines;
-- +end -- +end

View File

@ -0,0 +1,29 @@
-- +up
-- +begin
CREATE TABLE `kucoin_klines`
(
`gid` INTEGER PRIMARY KEY AUTOINCREMENT,
`exchange` VARCHAR(10) NOT NULL,
`start_time` DATETIME(3) NOT NULL,
`end_time` DATETIME(3) NOT NULL,
`interval` VARCHAR(3) NOT NULL,
`symbol` VARCHAR(7) NOT NULL,
`open` DECIMAL(16, 8) NOT NULL,
`high` DECIMAL(16, 8) NOT NULL,
`low` DECIMAL(16, 8) NOT NULL,
`close` DECIMAL(16, 8) NOT NULL DEFAULT 0.0,
`volume` DECIMAL(16, 8) NOT NULL DEFAULT 0.0,
`closed` BOOLEAN NOT NULL DEFAULT TRUE,
`last_trade_id` INT NOT NULL DEFAULT 0,
`num_trades` INT NOT NULL DEFAULT 0,
`quote_volume` DECIMAL NOT NULL DEFAULT 0.0,
`taker_buy_base_volume` DECIMAL NOT NULL DEFAULT 0.0,
`taker_buy_quote_volume` DECIMAL NOT NULL DEFAULT 0.0
);
-- +end
-- +down
-- +begin
DROP TABLE kucoin_klines;
-- +end