From bb9a78757509c2af16adff38cd60c101f9bd39a7 Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 4 May 2022 18:45:36 +0800 Subject: [PATCH] add interest and fix net asset column --- .../20220504184155_fix_net_asset_column.sql | 17 +++++++++++++++++ .../20220503144849_add_margin_info_to_nav.sql | 2 +- .../20220504184155_fix_net_asset_column.sql | 11 +++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 migrations/mysql/20220504184155_fix_net_asset_column.sql create mode 100644 migrations/sqlite3/20220504184155_fix_net_asset_column.sql diff --git a/migrations/mysql/20220504184155_fix_net_asset_column.sql b/migrations/mysql/20220504184155_fix_net_asset_column.sql new file mode 100644 index 000000000..77f130865 --- /dev/null +++ b/migrations/mysql/20220504184155_fix_net_asset_column.sql @@ -0,0 +1,17 @@ +-- +up +-- +begin +ALTER TABLE `nav_history_details` + MODIFY COLUMN `net_asset` DECIMAL(32, 8) DEFAULT 0.00000000 NOT NULL; +-- +end + +-- +begin +ALTER TABLE `nav_history_details` + ADD COLUMN `interest` DECIMAL(32, 20) UNSIGNED DEFAULT 0.00000000 NOT NULL; +-- +end + +-- +down + +-- +begin +ALTER TABLE `nav_history_details` + DROP COLUMN `interest`; +-- +end diff --git a/migrations/sqlite3/20220503144849_add_margin_info_to_nav.sql b/migrations/sqlite3/20220503144849_add_margin_info_to_nav.sql index 9f6cec2da..921d78bed 100644 --- a/migrations/sqlite3/20220503144849_add_margin_info_to_nav.sql +++ b/migrations/sqlite3/20220503144849_add_margin_info_to_nav.sql @@ -1,7 +1,7 @@ -- +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 `net_asset` DECIMAL UNSIGNED 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 `is_margin` BOOL DEFAULT FALSE NOT NULL; ALTER TABLE `nav_history_details` ADD COLUMN `is_isolated` BOOL DEFAULT FALSE NOT NULL; diff --git a/migrations/sqlite3/20220504184155_fix_net_asset_column.sql b/migrations/sqlite3/20220504184155_fix_net_asset_column.sql new file mode 100644 index 000000000..96993735e --- /dev/null +++ b/migrations/sqlite3/20220504184155_fix_net_asset_column.sql @@ -0,0 +1,11 @@ +-- +up +-- +begin +ALTER TABLE `nav_history_details` ADD COLUMN `interest` DECIMAL DEFAULT 0.00000000 NOT NULL; +-- +end + + +-- +down + +-- +begin +SELECT 1; +-- +end