migrations: add margin info columns to nav table

This commit is contained in:
c9s 2022-05-03 14:54:16 +08:00
parent b00c9f0c0d
commit 816f05cd88
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
3 changed files with 38 additions and 11 deletions

View File

@ -0,0 +1,19 @@
-- +up
-- +begin
ALTER TABLE `nav_history_details`
ADD COLUMN `net_asset` DECIMAL(32, 8) UNSIGNED DEFAULT 0.00000000 NOT NULL,
ADD COLUMN `borrowed` DECIMAL(32, 8) UNSIGNED DEFAULT 0.00000000 NOT NULL,
ADD COLUMN `price_in_usd` DECIMAL(32, 8) UNSIGNED DEFAULT 0.00000000 NOT NULL
;
-- +end
-- +down
-- +begin
ALTER TABLE `nav_history_details`
DROP COLUMN `net_asset`,
DROP COLUMN `borrowed`,
DROP COLUMN `price_in_usd`
;
-- +end

View File

@ -0,0 +1,8 @@
-- +up
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 `price_in_usd` DECIMAL UNSIGNED DEFAULT 0.00000000 NOT NULL;
-- +down
-- we can not rollback alter table change in sqlite
SELECT 1;