migrations: make fee column signed for ftx

This commit is contained in:
c9s 2022-04-19 12:19:14 +08:00
parent b9c40b63ac
commit a0e49fb2ba
6 changed files with 17 additions and 15 deletions

View File

@ -11,7 +11,7 @@ CREATE TABLE `trades`
`quantity` DECIMAL(16, 8) UNSIGNED NOT NULL, `quantity` DECIMAL(16, 8) UNSIGNED NOT NULL,
`quote_quantity` DECIMAL(16, 8) UNSIGNED NOT NULL, `quote_quantity` DECIMAL(16, 8) UNSIGNED NOT NULL,
`fee` 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_buyer` BOOLEAN NOT NULL DEFAULT FALSE,
`is_maker` BOOLEAN NOT NULL DEFAULT FALSE, `is_maker` BOOLEAN NOT NULL DEFAULT FALSE,
`side` VARCHAR(4) NOT NULL DEFAULT '', `side` VARCHAR(4) NOT NULL DEFAULT '',

View File

@ -7,11 +7,11 @@ CREATE TABLE `klines`
`end_time` DATETIME(3) NOT NULL, `end_time` DATETIME(3) NOT NULL,
`interval` VARCHAR(3) NOT NULL, `interval` VARCHAR(3) NOT NULL,
`symbol` VARCHAR(20) NOT NULL, `symbol` VARCHAR(20) NOT NULL,
`open` DECIMAL(16, 8) UNSIGNED NOT NULL, `open` DECIMAL(20, 8) UNSIGNED NOT NULL,
`high` DECIMAL(16, 8) UNSIGNED NOT NULL, `high` DECIMAL(20, 8) UNSIGNED NOT NULL,
`low` DECIMAL(16, 8) UNSIGNED NOT NULL, `low` DECIMAL(20, 8) UNSIGNED NOT NULL,
`close` DECIMAL(16, 8) UNSIGNED NOT NULL DEFAULT 0.0, `close` DECIMAL(20, 8) UNSIGNED NOT NULL DEFAULT 0.0,
`volume` DECIMAL(16, 8) UNSIGNED NOT NULL DEFAULT 0.0, `volume` DECIMAL(20, 8) UNSIGNED NOT NULL DEFAULT 0.0,
`closed` BOOL NOT NULL DEFAULT TRUE, `closed` BOOL NOT NULL DEFAULT TRUE,
`last_trade_id` INT UNSIGNED NOT NULL DEFAULT 0, `last_trade_id` INT UNSIGNED NOT NULL DEFAULT 0,
`num_trades` INT UNSIGNED NOT NULL DEFAULT 0, `num_trades` INT UNSIGNED NOT NULL DEFAULT 0,

View File

@ -8,11 +8,11 @@ create table if not exists ftx_klines
start_time datetime(3) not null, start_time datetime(3) not null,
end_time datetime(3) not null, end_time datetime(3) not null,
`interval` varchar(3) not null, `interval` varchar(3) not null,
symbol varchar(12) not null, symbol varchar(20) not null,
open decimal(16,8) unsigned not null, open decimal(20,8) unsigned not null,
high decimal(16,8) unsigned not null, high decimal(20,8) unsigned not null,
low decimal(16,8) unsigned not null, low decimal(20,8) unsigned not null,
close decimal(16,8) unsigned default 0.00000000 not null, close decimal(20,8) unsigned default 0.00000000 not null,
volume 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, closed tinyint(1) default 1 not null,
last_trade_id int unsigned default '0' not null, last_trade_id int unsigned default '0' not null,

View File

@ -1,9 +1,9 @@
-- +up -- +up
-- +begin -- +begin
ALTER TABLE trades CHANGE fee_currency fee_currency varchar(10) NOT NULL; SELECT 1;
-- +end -- +end
-- +down -- +down
-- +begin -- +begin
ALTER TABLE trades CHANGE fee_currency fee_currency varchar(4) NOT NULL; SELECT 1;
-- +end -- +end

View File

@ -59,8 +59,8 @@ CREATE TABLE `profits`
`traded_at` DATETIME(3) NOT NULL, `traded_at` DATETIME(3) NOT NULL,
-- fee -- fee
`fee_in_usd` DECIMAL(16, 8) UNSIGNED, `fee_in_usd` DECIMAL(16, 8),
`fee` DECIMAL(16, 8) UNSIGNED NOT NULL, `fee` DECIMAL(16, 8) NOT NULL,
`fee_currency` VARCHAR(10) NOT NULL, `fee_currency` VARCHAR(10) NOT NULL,
PRIMARY KEY (`gid`), PRIMARY KEY (`gid`),

View File

@ -1,8 +1,10 @@
-- +up -- +up
-- +begin -- +begin
SELECT 1;
-- +end -- +end
-- +down -- +down
-- +begin -- +begin
SELECT 1;
-- +end -- +end