From ce07c3eda4ed3a6e50a41f81c5e1ff66f836d2d2 Mon Sep 17 00:00:00 2001 From: c9s Date: Sun, 26 Dec 2021 02:30:45 +0800 Subject: [PATCH] migrations: clean up and add kucoin klines table --- ...0531234123_add_kline_taker_buy_columns.sql | 18 ++++++------ ...204014905_update_taker_buy_base_volumn.sql | 21 -------------- .../20211226022411_add_kucoin_klines.sql | 10 +++++++ ...204014905_update_taker_buy_base_volumn.sql | 8 ----- .../sqlite3/20211211020303_add_ftx_kline.sql | 2 +- .../20211226022411_add_kucoin_klines.sql | 29 +++++++++++++++++++ 6 files changed, 49 insertions(+), 39 deletions(-) delete mode 100644 migrations/mysql/20211204014905_update_taker_buy_base_volumn.sql create mode 100644 migrations/mysql/20211226022411_add_kucoin_klines.sql delete mode 100644 migrations/sqlite3/20211204014905_update_taker_buy_base_volumn.sql create mode 100644 migrations/sqlite3/20211226022411_add_kucoin_klines.sql diff --git a/migrations/mysql/20210531234123_add_kline_taker_buy_columns.sql b/migrations/mysql/20210531234123_add_kline_taker_buy_columns.sql index 35a2b4616..b30387094 100644 --- a/migrations/mysql/20210531234123_add_kline_taker_buy_columns.sql +++ b/migrations/mysql/20210531234123_add_kline_taker_buy_columns.sql @@ -1,21 +1,21 @@ -- +up -- +begin ALTER TABLE `binance_klines` - ADD COLUMN `quote_volume` DECIMAL(32, 4) NOT NULL DEFAULT 0.0, - ADD COLUMN `taker_buy_base_volume` DECIMAL(16, 8) NOT NULL DEFAULT 0.0, - ADD COLUMN `taker_buy_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(32, 8) NOT NULL DEFAULT 0.0, + ADD COLUMN `taker_buy_quote_volume` DECIMAL(32, 8) NOT NULL DEFAULT 0.0; -- +end -- +begin ALTER TABLE `max_klines` - ADD COLUMN `quote_volume` DECIMAL(32, 4) NOT NULL DEFAULT 0.0, - ADD COLUMN `taker_buy_base_volume` DECIMAL(16, 8) NOT NULL DEFAULT 0.0, - ADD COLUMN `taker_buy_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(32, 8) NOT NULL DEFAULT 0.0, + ADD COLUMN `taker_buy_quote_volume` DECIMAL(32, 8) NOT NULL DEFAULT 0.0; -- +end -- +begin ALTER TABLE `okex_klines` - ADD COLUMN `quote_volume` DECIMAL(32, 4) NOT NULL DEFAULT 0.0, - ADD COLUMN `taker_buy_base_volume` DECIMAL(16, 8) NOT NULL DEFAULT 0.0, - ADD COLUMN `taker_buy_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(32, 8) NOT NULL DEFAULT 0.0, + ADD COLUMN `taker_buy_quote_volume` DECIMAL(32, 8) NOT NULL DEFAULT 0.0; -- +end -- +down diff --git a/migrations/mysql/20211204014905_update_taker_buy_base_volumn.sql b/migrations/mysql/20211204014905_update_taker_buy_base_volumn.sql deleted file mode 100644 index 15d236a03..000000000 --- a/migrations/mysql/20211204014905_update_taker_buy_base_volumn.sql +++ /dev/null @@ -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 diff --git a/migrations/mysql/20211226022411_add_kucoin_klines.sql b/migrations/mysql/20211226022411_add_kucoin_klines.sql new file mode 100644 index 000000000..4d65d58ef --- /dev/null +++ b/migrations/mysql/20211226022411_add_kucoin_klines.sql @@ -0,0 +1,10 @@ +-- +up +-- +begin +CREATE TABLE `kucoin_klines` LIKE `binance_klines`; +-- +end + +-- +down + +-- +begin +DROP TABLE `kucoin_klines`; +-- +end diff --git a/migrations/sqlite3/20211204014905_update_taker_buy_base_volumn.sql b/migrations/sqlite3/20211204014905_update_taker_buy_base_volumn.sql deleted file mode 100644 index a88ad32d4..000000000 --- a/migrations/sqlite3/20211204014905_update_taker_buy_base_volumn.sql +++ /dev/null @@ -1,8 +0,0 @@ --- +up --- +begin --- +end - --- +down - --- +begin --- +end diff --git a/migrations/sqlite3/20211211020303_add_ftx_kline.sql b/migrations/sqlite3/20211211020303_add_ftx_kline.sql index 83da4ff73..0b34d02e8 100644 --- a/migrations/sqlite3/20211211020303_add_ftx_kline.sql +++ b/migrations/sqlite3/20211211020303_add_ftx_kline.sql @@ -26,5 +26,5 @@ CREATE TABLE `ftx_klines` -- +down -- +begin -drop table ftx_klines; +DROP TABLE ftx_klines; -- +end diff --git a/migrations/sqlite3/20211226022411_add_kucoin_klines.sql b/migrations/sqlite3/20211226022411_add_kucoin_klines.sql new file mode 100644 index 000000000..c53a00193 --- /dev/null +++ b/migrations/sqlite3/20211226022411_add_kucoin_klines.sql @@ -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