From a0e49fb2ba0b4cac7916fdc703b1a1ac4c9c5c89 Mon Sep 17 00:00:00 2001 From: c9s Date: Tue, 19 Apr 2022 12:19:14 +0800 Subject: [PATCH] migrations: make fee column signed for ftx --- migrations/mysql/20200721225616_trades.sql | 2 +- migrations/mysql/20201106114742_klines.sql | 10 +++++----- migrations/mysql/20211211020303_add_ftx_kline.sql | 10 +++++----- .../20211211103657_update_fee_currency_length.sql | 4 ++-- migrations/mysql/20220304153317_add_profit_table.sql | 4 ++-- .../20211211103657_update_fee_currency_length.sql | 2 ++ 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/migrations/mysql/20200721225616_trades.sql b/migrations/mysql/20200721225616_trades.sql index 175f532ff..98ba49b3e 100644 --- a/migrations/mysql/20200721225616_trades.sql +++ b/migrations/mysql/20200721225616_trades.sql @@ -11,7 +11,7 @@ CREATE TABLE `trades` `quantity` DECIMAL(16, 8) UNSIGNED NOT NULL, `quote_quantity` DECIMAL(16, 8) UNSIGNED NOT NULL, `fee` DECIMAL(16, 8) UNSIGNED NOT NULL, - `fee_currency` VARCHAR(6) NOT NULL, + `fee_currency` VARCHAR(10) NOT NULL, `is_buyer` BOOLEAN NOT NULL DEFAULT FALSE, `is_maker` BOOLEAN NOT NULL DEFAULT FALSE, `side` VARCHAR(4) NOT NULL DEFAULT '', diff --git a/migrations/mysql/20201106114742_klines.sql b/migrations/mysql/20201106114742_klines.sql index be855028a..755f98f81 100644 --- a/migrations/mysql/20201106114742_klines.sql +++ b/migrations/mysql/20201106114742_klines.sql @@ -7,11 +7,11 @@ CREATE TABLE `klines` `end_time` DATETIME(3) NOT NULL, `interval` VARCHAR(3) NOT NULL, `symbol` VARCHAR(20) NOT NULL, - `open` DECIMAL(16, 8) UNSIGNED NOT NULL, - `high` DECIMAL(16, 8) UNSIGNED NOT NULL, - `low` DECIMAL(16, 8) UNSIGNED NOT NULL, - `close` DECIMAL(16, 8) UNSIGNED NOT NULL DEFAULT 0.0, - `volume` DECIMAL(16, 8) UNSIGNED NOT NULL DEFAULT 0.0, + `open` DECIMAL(20, 8) UNSIGNED NOT NULL, + `high` DECIMAL(20, 8) UNSIGNED NOT NULL, + `low` DECIMAL(20, 8) UNSIGNED NOT NULL, + `close` DECIMAL(20, 8) UNSIGNED NOT NULL DEFAULT 0.0, + `volume` DECIMAL(20, 8) UNSIGNED NOT NULL DEFAULT 0.0, `closed` BOOL NOT NULL DEFAULT TRUE, `last_trade_id` INT UNSIGNED NOT NULL DEFAULT 0, `num_trades` INT UNSIGNED NOT NULL DEFAULT 0, diff --git a/migrations/mysql/20211211020303_add_ftx_kline.sql b/migrations/mysql/20211211020303_add_ftx_kline.sql index 21827730e..3ba384f56 100644 --- a/migrations/mysql/20211211020303_add_ftx_kline.sql +++ b/migrations/mysql/20211211020303_add_ftx_kline.sql @@ -8,11 +8,11 @@ create table if not exists ftx_klines start_time datetime(3) not null, end_time datetime(3) not null, `interval` varchar(3) not null, - symbol varchar(12) not null, - open decimal(16,8) unsigned not null, - high decimal(16,8) unsigned not null, - low decimal(16,8) unsigned not null, - close decimal(16,8) unsigned default 0.00000000 not null, + symbol varchar(20) not null, + open decimal(20,8) unsigned not null, + high decimal(20,8) unsigned not null, + low decimal(20,8) unsigned not null, + close decimal(20,8) unsigned default 0.00000000 not null, volume decimal(20,8) unsigned default 0.00000000 not null, closed tinyint(1) default 1 not null, last_trade_id int unsigned default '0' not null, diff --git a/migrations/mysql/20211211103657_update_fee_currency_length.sql b/migrations/mysql/20211211103657_update_fee_currency_length.sql index 89bda824b..8a69dd96a 100644 --- a/migrations/mysql/20211211103657_update_fee_currency_length.sql +++ b/migrations/mysql/20211211103657_update_fee_currency_length.sql @@ -1,9 +1,9 @@ -- +up -- +begin -ALTER TABLE trades CHANGE fee_currency fee_currency varchar(10) NOT NULL; +SELECT 1; -- +end -- +down -- +begin -ALTER TABLE trades CHANGE fee_currency fee_currency varchar(4) NOT NULL; +SELECT 1; -- +end diff --git a/migrations/mysql/20220304153317_add_profit_table.sql b/migrations/mysql/20220304153317_add_profit_table.sql index f74a21304..96037a09c 100644 --- a/migrations/mysql/20220304153317_add_profit_table.sql +++ b/migrations/mysql/20220304153317_add_profit_table.sql @@ -59,8 +59,8 @@ CREATE TABLE `profits` `traded_at` DATETIME(3) NOT NULL, -- fee - `fee_in_usd` DECIMAL(16, 8) UNSIGNED, - `fee` DECIMAL(16, 8) UNSIGNED NOT NULL, + `fee_in_usd` DECIMAL(16, 8), + `fee` DECIMAL(16, 8) NOT NULL, `fee_currency` VARCHAR(10) NOT NULL, PRIMARY KEY (`gid`), diff --git a/migrations/sqlite3/20211211103657_update_fee_currency_length.sql b/migrations/sqlite3/20211211103657_update_fee_currency_length.sql index a88ad32d4..9f146225e 100644 --- a/migrations/sqlite3/20211211103657_update_fee_currency_length.sql +++ b/migrations/sqlite3/20211211103657_update_fee_currency_length.sql @@ -1,8 +1,10 @@ -- +up -- +begin +SELECT 1; -- +end -- +down -- +begin +SELECT 1; -- +end