mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
migrations: add margin info columns to nav table
This commit is contained in:
parent
b00c9f0c0d
commit
816f05cd88
|
@ -2,21 +2,21 @@
|
||||||
-- +begin
|
-- +begin
|
||||||
CREATE TABLE nav_history_details
|
CREATE TABLE nav_history_details
|
||||||
(
|
(
|
||||||
gid bigint unsigned auto_increment PRIMARY KEY,
|
gid bigint unsigned auto_increment PRIMARY KEY,
|
||||||
exchange VARCHAR(30) NOT NULL,
|
exchange VARCHAR(30) NOT NULL,
|
||||||
subaccount VARCHAR(30) NOT NULL,
|
subaccount VARCHAR(30) NOT NULL,
|
||||||
time DATETIME(3) NOT NULL,
|
time DATETIME(3) NOT NULL,
|
||||||
currency VARCHAR(12) NOT NULL,
|
currency VARCHAR(12) NOT NULL,
|
||||||
balance_in_usd DECIMAL(32, 8) UNSIGNED DEFAULT 0.00000000 NOT NULL,
|
balance_in_usd DECIMAL(32, 8) UNSIGNED DEFAULT 0.00000000 NOT NULL,
|
||||||
balance_in_btc DECIMAL(32, 8) UNSIGNED DEFAULT 0.00000000 NOT NULL,
|
balance_in_btc DECIMAL(32, 8) UNSIGNED DEFAULT 0.00000000 NOT NULL,
|
||||||
balance DECIMAL(32, 8) UNSIGNED DEFAULT 0.00000000 NOT NULL,
|
balance DECIMAL(32, 8) UNSIGNED DEFAULT 0.00000000 NOT NULL,
|
||||||
available DECIMAL(32, 8) UNSIGNED DEFAULT 0.00000000 NOT NULL,
|
available DECIMAL(32, 8) UNSIGNED DEFAULT 0.00000000 NOT NULL,
|
||||||
locked DECIMAL(32, 8) UNSIGNED DEFAULT 0.00000000 NOT NULL
|
locked DECIMAL(32, 8) UNSIGNED DEFAULT 0.00000000 NOT NULL
|
||||||
);
|
);
|
||||||
-- +end
|
-- +end
|
||||||
-- +begin
|
-- +begin
|
||||||
CREATE INDEX idx_nav_history_details
|
CREATE INDEX idx_nav_history_details
|
||||||
on nav_history_details(time, currency, exchange);
|
on nav_history_details (time, currency, exchange);
|
||||||
-- +end
|
-- +end
|
||||||
|
|
||||||
-- +down
|
-- +down
|
||||||
|
|
19
migrations/mysql/20220503144849_add_margin_info_to_nav.sql
Normal file
19
migrations/mysql/20220503144849_add_margin_info_to_nav.sql
Normal 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
|
|
@ -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;
|
Loading…
Reference in New Issue
Block a user