mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
add migration files
This commit is contained in:
parent
44145203c6
commit
e06a480b04
23
migrations/20200721225616_trades.sql
Normal file
23
migrations/20200721225616_trades.sql
Normal file
|
@ -0,0 +1,23 @@
|
|||
-- +goose Up
|
||||
CREATE TABLE `trades` (
|
||||
`gid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
|
||||
`id` BIGINT UNSIGNED,
|
||||
`exchange` VARCHAR(24) NOT NULL DEFAULT '',
|
||||
`symbol` VARCHAR(7) NOT NULL,
|
||||
`price` DECIMAL(16, 8) UNSIGNED NOT NULL,
|
||||
`quantity` DECIMAL(16, 8) UNSIGNED NOT NULL,
|
||||
`quote_quantity` DECIMAL(16, 8) UNSIGNED NOT NULL,
|
||||
`fee` DECIMAL(16, 8) UNSIGNED NOT NULL,
|
||||
`fee_currency` VARCHAR(4) NOT NULL,
|
||||
`is_buyer` BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
`is_maker` BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
`side` VARCHAR(4) NOT NULL DEFAULT '',
|
||||
`traded_at` DATETIME(6) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`gid`),
|
||||
UNIQUE KEY `id` (`id`)
|
||||
|
||||
) ENGINE=InnoDB;
|
||||
-- +goose Down
|
||||
DROP TABLE `trades`;
|
9
migrations/20200819054742_trade_index.sql
Normal file
9
migrations/20200819054742_trade_index.sql
Normal file
|
@ -0,0 +1,9 @@
|
|||
-- +goose Up
|
||||
CREATE INDEX trades_symbol ON trades(symbol);
|
||||
CREATE INDEX trades_symbol_fee_currency ON trades(symbol, fee_currency, traded_at);
|
||||
CREATE INDEX trades_traded_at_symbol ON trades(traded_at, symbol);
|
||||
|
||||
-- +goose Down
|
||||
DROP INDEX trades_symbol ON trades;
|
||||
DROP INDEX trades_symbol_fee_currency ON trades;
|
||||
DROP INDEX trades_traded_at_symbol ON trades;
|
Loading…
Reference in New Issue
Block a user