From ed6a401dec1301260788e8caa9aee80afc485514 Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 3 Jan 2024 18:07:20 +0800 Subject: [PATCH] add funding_fees table migrations --- .../20240103175426_add_funding_fees_table.sql | 31 +++++++++++++++++++ .../20240103175426_add_funding_fees_table.sql | 31 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 migrations/mysql/20240103175426_add_funding_fees_table.sql create mode 100644 migrations/sqlite3/20240103175426_add_funding_fees_table.sql diff --git a/migrations/mysql/20240103175426_add_funding_fees_table.sql b/migrations/mysql/20240103175426_add_funding_fees_table.sql new file mode 100644 index 000000000..703e308db --- /dev/null +++ b/migrations/mysql/20240103175426_add_funding_fees_table.sql @@ -0,0 +1,31 @@ +-- +up +-- +begin +CREATE TABLE `funding_fees` +( + `gid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, + + -- transaction id + `txn_id` BIGINT UNSIGNED NOT NULL, + + -- for exchange + `exchange` VARCHAR(24) NOT NULL DEFAULT '', + + -- asset name, BTC, MAX, USDT ... etc + `asset` VARCHAR(5) NOT NULL, + + -- the amount of the funding fee + `amount` DECIMAL(16, 8) NOT NULL, + + `funded_at` DATETIME NOT NULL, + + PRIMARY KEY (`gid`), + + UNIQUE KEY `txn_id` (`txn_id`, `exchange`) +); +-- +end + +-- +down + +-- +begin +DROP TABLE `funding_fees`; +-- +end diff --git a/migrations/sqlite3/20240103175426_add_funding_fees_table.sql b/migrations/sqlite3/20240103175426_add_funding_fees_table.sql new file mode 100644 index 000000000..0f1dc6708 --- /dev/null +++ b/migrations/sqlite3/20240103175426_add_funding_fees_table.sql @@ -0,0 +1,31 @@ +-- +up +-- +begin +CREATE TABLE `funding_fees` +( + `gid` INTEGER PRIMARY KEY AUTOINCREMENT, + + -- transaction id + `txn_id` INTEGER NOT NULL, + + -- for exchange + `exchange` VARCHAR(24) NOT NULL DEFAULT '', + + -- asset name, BTC, MAX, USDT ... etc + `asset` VARCHAR(5) NOT NULL, + + -- the amount of the funding fee + `amount` DECIMAL(16, 8) NOT NULL, + + `funded_at` DATETIME NOT NULL, + + PRIMARY KEY (`gid`), + + UNIQUE KEY `txn_id` (`txn_id`, `exchange`) +); +-- +end + +-- +down + +-- +begin +DROP TABLE `funding_fees`; +-- +end