diff --git a/migrations/sqlite3/20201106114742_klines.sql b/migrations/sqlite3/20201106114742_klines.sql index 72c679206..9e5756450 100644 --- a/migrations/sqlite3/20201106114742_klines.sql +++ b/migrations/sqlite3/20201106114742_klines.sql @@ -3,37 +3,90 @@ CREATE TABLE `klines` ( `gid` INTEGER PRIMARY KEY AUTOINCREMENT, - `exchange` VARCHAR(10) NOT NULL, - `start_time` DATETIME(3) NOT NULL, - `end_time` DATETIME(3) NOT NULL, - `interval` VARCHAR(3) NOT NULL, - `symbol` VARCHAR(7) NOT NULL, - `open` DECIMAL(16, 8) NOT NULL, - `high` DECIMAL(16, 8) NOT NULL, - `low` DECIMAL(16, 8) NOT NULL, - `close` DECIMAL(16, 8) NOT NULL DEFAULT 0.0, - `volume` DECIMAL(16, 8) NOT NULL DEFAULT 0.0, - `closed` BOOLEAN NOT NULL DEFAULT TRUE, - `last_trade_id` INT NOT NULL DEFAULT 0, - `num_trades` INT NOT NULL DEFAULT 0 + `exchange` VARCHAR(10) NOT NULL, + `start_time` DATETIME(3) NOT NULL, + `end_time` DATETIME(3) NOT NULL, + `interval` VARCHAR(3) NOT NULL, + `symbol` VARCHAR(7) NOT NULL, + `open` DECIMAL(16, 8) NOT NULL, + `high` DECIMAL(16, 8) NOT NULL, + `low` DECIMAL(16, 8) NOT NULL, + `close` DECIMAL(16, 8) NOT NULL DEFAULT 0.0, + `volume` DECIMAL(16, 8) NOT NULL DEFAULT 0.0, + `closed` BOOLEAN NOT NULL DEFAULT TRUE, + `last_trade_id` INT NOT NULL DEFAULT 0, + `num_trades` INT NOT NULL DEFAULT 0 +); +-- +end + + +-- +begin +CREATE TABLE `okex_klines` +( + `gid` INTEGER PRIMARY KEY AUTOINCREMENT, + `exchange` VARCHAR(10) NOT NULL, + `start_time` DATETIME(3) NOT NULL, + `end_time` DATETIME(3) NOT NULL, + `interval` VARCHAR(3) NOT NULL, + `symbol` VARCHAR(7) NOT NULL, + `open` DECIMAL(16, 8) NOT NULL, + `high` DECIMAL(16, 8) NOT NULL, + `low` DECIMAL(16, 8) NOT NULL, + `close` DECIMAL(16, 8) NOT NULL DEFAULT 0.0, + `volume` DECIMAL(16, 8) NOT NULL DEFAULT 0.0, + `closed` BOOLEAN NOT NULL DEFAULT TRUE, + `last_trade_id` INT NOT NULL DEFAULT 0, + `num_trades` INT NOT NULL DEFAULT 0 ); -- +end -- +begin -CREATE INDEX `klines_end_time_symbol_interval` ON klines (`end_time`, `symbol`, `interval`); +CREATE TABLE `binance_klines` +( + `gid` INTEGER PRIMARY KEY AUTOINCREMENT, + `exchange` VARCHAR(10) NOT NULL, + `start_time` DATETIME(3) NOT NULL, + `end_time` DATETIME(3) NOT NULL, + `interval` VARCHAR(3) NOT NULL, + `symbol` VARCHAR(7) NOT NULL, + `open` DECIMAL(16, 8) NOT NULL, + `high` DECIMAL(16, 8) NOT NULL, + `low` DECIMAL(16, 8) NOT NULL, + `close` DECIMAL(16, 8) NOT NULL DEFAULT 0.0, + `volume` DECIMAL(16, 8) NOT NULL DEFAULT 0.0, + `closed` BOOLEAN NOT NULL DEFAULT TRUE, + `last_trade_id` INT NOT NULL DEFAULT 0, + `num_trades` INT NOT NULL DEFAULT 0 +); -- +end -- +begin -CREATE TABLE `okex_klines` AS SELECT * FROM `klines` WHERE 0 +CREATE TABLE `max_klines` +( + `gid` INTEGER PRIMARY KEY AUTOINCREMENT, + `exchange` VARCHAR(10) NOT NULL, + `start_time` DATETIME(3) NOT NULL, + `end_time` DATETIME(3) NOT NULL, + `interval` VARCHAR(3) NOT NULL, + `symbol` VARCHAR(7) NOT NULL, + `open` DECIMAL(16, 8) NOT NULL, + `high` DECIMAL(16, 8) NOT NULL, + `low` DECIMAL(16, 8) NOT NULL, + `close` DECIMAL(16, 8) NOT NULL DEFAULT 0.0, + `volume` DECIMAL(16, 8) NOT NULL DEFAULT 0.0, + `closed` BOOLEAN NOT NULL DEFAULT TRUE, + `last_trade_id` INT NOT NULL DEFAULT 0, + `num_trades` INT NOT NULL DEFAULT 0 +); -- +end -- +begin -CREATE TABLE `binance_klines` AS SELECT * FROM `klines` WHERE 0 +CREATE INDEX `klines_end_time_symbol_interval` ON `klines` (`end_time`, `symbol`, `interval`); +CREATE INDEX `klines_end_time_symbol_interval` ON `binance_klines` (`end_time`, `symbol`, `interval`); +CREATE INDEX `klines_end_time_symbol_interval` ON `okex_klines` (`end_time`, `symbol`, `interval`); +CREATE INDEX `klines_end_time_symbol_interval` ON `max_klines` (`end_time`, `symbol`, `interval`); -- +end --- +begin -CREATE TABLE `max_klines` AS SELECT * FROM `klines` WHERE 0 --- +end -- +down DROP INDEX IF EXISTS `klines_end_time_symbol_interval`;