From f196cc9ccdd69be7081bff2d547d42fc47d2a3d6 Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 4 May 2022 19:05:31 +0800 Subject: [PATCH] change balance_in_usd and balance_in_btc to signed --- .../20220504184155_fix_net_asset_column.sql | 4 +++- .../20211211034818_add_nav_history_details.sql | 16 ++++++++-------- .../20220503144849_add_margin_info_to_nav.sql | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/migrations/mysql/20220504184155_fix_net_asset_column.sql b/migrations/mysql/20220504184155_fix_net_asset_column.sql index 77f130865..8c7e89541 100644 --- a/migrations/mysql/20220504184155_fix_net_asset_column.sql +++ b/migrations/mysql/20220504184155_fix_net_asset_column.sql @@ -1,7 +1,9 @@ -- +up -- +begin ALTER TABLE `nav_history_details` - MODIFY COLUMN `net_asset` DECIMAL(32, 8) DEFAULT 0.00000000 NOT NULL; + MODIFY COLUMN `net_asset` DECIMAL(32, 8) DEFAULT 0.00000000 NOT NULL, + MODIFY COLUMN `balance_in_usd` DECIMAL(32, 2) DEFAULT 0.00000000 NOT NULL, + MODIFY COLUMN `balance_in_btc` DECIMAL(32, 20) DEFAULT 0.00000000 NOT NULL; -- +end -- +begin diff --git a/migrations/sqlite3/20211211034818_add_nav_history_details.sql b/migrations/sqlite3/20211211034818_add_nav_history_details.sql index 163b9787e..60707c20e 100644 --- a/migrations/sqlite3/20211211034818_add_nav_history_details.sql +++ b/migrations/sqlite3/20211211034818_add_nav_history_details.sql @@ -2,16 +2,16 @@ -- +begin CREATE TABLE `nav_history_details` ( - gid bigint unsigned auto_increment PRIMARY KEY, - `exchange` VARCHAR NOT NULL DEFAULT '', - `subaccount` VARCHAR NOT NULL DEFAULT '', - time DATETIME(3) NOT NULL DEFAULT (strftime('%s','now')), - currency VARCHAR NOT NULL, + gid bigint unsigned auto_increment PRIMARY KEY, + `exchange` VARCHAR NOT NULL DEFAULT '', + `subaccount` VARCHAR NOT NULL DEFAULT '', + time DATETIME(3) NOT NULL DEFAULT (strftime('%s', 'now')), + currency VARCHAR NOT NULL, balance_in_usd DECIMAL DEFAULT 0.00000000 NOT NULL, balance_in_btc DECIMAL DEFAULT 0.00000000 NOT NULL, - balance DECIMAL DEFAULT 0.00000000 NOT NULL, - available DECIMAL DEFAULT 0.00000000 NOT NULL, - locked DECIMAL DEFAULT 0.00000000 NOT NULL + balance DECIMAL DEFAULT 0.00000000 NOT NULL, + available DECIMAL DEFAULT 0.00000000 NOT NULL, + locked DECIMAL DEFAULT 0.00000000 NOT NULL ); -- +end -- +begin diff --git a/migrations/sqlite3/20220503144849_add_margin_info_to_nav.sql b/migrations/sqlite3/20220503144849_add_margin_info_to_nav.sql index 921d78bed..7f2fc06e0 100644 --- a/migrations/sqlite3/20220503144849_add_margin_info_to_nav.sql +++ b/migrations/sqlite3/20220503144849_add_margin_info_to_nav.sql @@ -1,8 +1,8 @@ -- +up ALTER TABLE `nav_history_details` ADD COLUMN `session` VARCHAR(50) NOT NULL; -ALTER TABLE `nav_history_details` ADD COLUMN `borrowed` DECIMAL UNSIGNED DEFAULT 0.00000000 NOT NULL; +ALTER TABLE `nav_history_details` ADD COLUMN `borrowed` DECIMAL DEFAULT 0.00000000 NOT NULL; ALTER TABLE `nav_history_details` ADD COLUMN `net_asset` DECIMAL DEFAULT 0.00000000 NOT NULL; -ALTER TABLE `nav_history_details` ADD COLUMN `price_in_usd` DECIMAL UNSIGNED DEFAULT 0.00000000 NOT NULL; +ALTER TABLE `nav_history_details` ADD COLUMN `price_in_usd` DECIMAL DEFAULT 0.00000000 NOT NULL; ALTER TABLE `nav_history_details` ADD COLUMN `is_margin` BOOL DEFAULT FALSE NOT NULL; ALTER TABLE `nav_history_details` ADD COLUMN `is_isolated` BOOL DEFAULT FALSE NOT NULL; ALTER TABLE `nav_history_details` ADD COLUMN `isolated_symbol` VARCHAR(30) DEFAULT '' NOT NULL;