diff --git a/migrations/mysql/20220531012226_margin_loans.sql b/migrations/mysql/20220531012226_margin_loans.sql new file mode 100644 index 000000000..dbbd1346c --- /dev/null +++ b/migrations/mysql/20220531012226_margin_loans.sql @@ -0,0 +1,24 @@ +-- +up +CREATE TABLE `margin_loans` +( + `gid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, + + `transaction_id` BIGINT UNSIGNED NOT NULL, + + `exchange` VARCHAR(24) NOT NULL DEFAULT '', + + `asset` VARCHAR(24) NOT NULL DEFAULT '', + + `isolated_symbol` VARCHAR(24) NOT NULL DEFAULT '', + + -- quantity is the quantity of the trade that makes profit + `principle` DECIMAL(16, 8) UNSIGNED NOT NULL, + + `time` DATETIME(3) NOT NULL, + + PRIMARY KEY (`gid`), + UNIQUE KEY (`transaction_id`) +); + +-- +down +DROP TABLE IF EXISTS `margin_loans`; diff --git a/migrations/mysql/20220531013327_margin_repays.sql b/migrations/mysql/20220531013327_margin_repays.sql new file mode 100644 index 000000000..873b1ed73 --- /dev/null +++ b/migrations/mysql/20220531013327_margin_repays.sql @@ -0,0 +1,24 @@ +-- +up +CREATE TABLE `margin_repays` +( + `gid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, + + `transaction_id` BIGINT UNSIGNED NOT NULL, + + `exchange` VARCHAR(24) NOT NULL DEFAULT '', + + `asset` VARCHAR(24) NOT NULL DEFAULT '', + + `isolated_symbol` VARCHAR(24) NOT NULL DEFAULT '', + + -- quantity is the quantity of the trade that makes profit + `principle` DECIMAL(16, 8) UNSIGNED NOT NULL, + + `time` DATETIME(3) NOT NULL, + + PRIMARY KEY (`gid`), + UNIQUE KEY (`transaction_id`) +); + +-- +down +DROP TABLE IF EXISTS `margin_repays`; diff --git a/migrations/mysql/20220531013542_margin_interests.sql b/migrations/mysql/20220531013542_margin_interests.sql new file mode 100644 index 000000000..2a7c9772c --- /dev/null +++ b/migrations/mysql/20220531013542_margin_interests.sql @@ -0,0 +1,27 @@ +-- +up +CREATE TABLE `margin_interests` +( + `gid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, + + `transaction_id` BIGINT UNSIGNED NOT NULL, + + `exchange` VARCHAR(24) NOT NULL DEFAULT '', + + `asset` VARCHAR(24) NOT NULL DEFAULT '', + + `isolated_symbol` VARCHAR(24) NOT NULL DEFAULT '', + + `principle` DECIMAL(16, 8) UNSIGNED NOT NULL, + + `interest` DECIMAL(20, 16) UNSIGNED NOT NULL, + + `interest_rate` DECIMAL(20, 16) UNSIGNED NOT NULL, + + `time` DATETIME(3) NOT NULL, + + PRIMARY KEY (`gid`), + UNIQUE KEY (`transaction_id`) +); + +-- +down +DROP TABLE IF EXISTS `margin_interests`; diff --git a/migrations/sqlite3/20220531012226_margin_loans.sql b/migrations/sqlite3/20220531012226_margin_loans.sql new file mode 100644 index 000000000..2569e671a --- /dev/null +++ b/migrations/sqlite3/20220531012226_margin_loans.sql @@ -0,0 +1,21 @@ +-- +up +CREATE TABLE `margin_loans` +( + `gid` INTEGER PRIMARY KEY AUTOINCREMENT, + + `transaction_id` INTEGER NOT NULL, + + `exchange` VARCHAR(24) NOT NULL DEFAULT '', + + `asset` VARCHAR(24) NOT NULL DEFAULT '', + + `isolated_symbol` VARCHAR(24) NOT NULL DEFAULT '', + + -- quantity is the quantity of the trade that makes profit + `principle` DECIMAL(16, 8) NOT NULL, + + `time` DATETIME(3) NOT NULL +); + +-- +down +DROP TABLE IF EXISTS `margin_loans`; diff --git a/migrations/sqlite3/20220531013327_margin_repays.sql b/migrations/sqlite3/20220531013327_margin_repays.sql new file mode 100644 index 000000000..c9f612365 --- /dev/null +++ b/migrations/sqlite3/20220531013327_margin_repays.sql @@ -0,0 +1,21 @@ +-- +up +CREATE TABLE `margin_repays` +( + `gid` INTEGER PRIMARY KEY AUTOINCREMENT, + + `transaction_id` INTEGER NOT NULL, + + `exchange` VARCHAR(24) NOT NULL DEFAULT '', + + `asset` VARCHAR(24) NOT NULL DEFAULT '', + + `isolated_symbol` VARCHAR(24) NOT NULL DEFAULT '', + + -- quantity is the quantity of the trade that makes profit + `principle` DECIMAL(16, 8) NOT NULL, + + `time` DATETIME(3) NOT NULL +); + +-- +down +DROP TABLE IF EXISTS `margin_repays`; diff --git a/migrations/sqlite3/20220531013541_margin_interests.sql b/migrations/sqlite3/20220531013541_margin_interests.sql new file mode 100644 index 000000000..b82c033ba --- /dev/null +++ b/migrations/sqlite3/20220531013541_margin_interests.sql @@ -0,0 +1,24 @@ +-- +up +CREATE TABLE `margin_interests` +( + `gid` INTEGER PRIMARY KEY AUTOINCREMENT, + + `transaction_id` INTEGER NOT NULL, + + `exchange` VARCHAR(24) NOT NULL DEFAULT '', + + `asset` VARCHAR(24) NOT NULL DEFAULT '', + + `isolated_symbol` VARCHAR(24) NOT NULL DEFAULT '', + + `principle` DECIMAL(16, 8) NOT NULL, + + `interest` DECIMAL(20, 16) NOT NULL, + + `interest_rate` DECIMAL(20, 16) NOT NULL, + + `time` DATETIME(3) NOT NULL +); + +-- +down +DROP TABLE IF EXISTS `margin_interests`;