add unique index for sqlite

This commit is contained in:
c9s 2022-05-20 16:36:25 +08:00
parent f9dd76d4cb
commit 04f552b169
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -1,10 +1,47 @@
-- +up -- +up
-- +begin -- +begin
SELECT 'up SQL query'; CREATE UNIQUE INDEX idx_kline_binance_unique
ON binance_klines (`symbol`, `interval`, `start_time`);
-- +end
-- +begin
CREATE UNIQUE INDEX idx_kline_max_unique
ON max_klines (`symbol`, `interval`, `start_time`);
-- +end
-- +begin
CREATE UNIQUE INDEX `idx_kline_ftx_unique`
ON ftx_klines (`symbol`, `interval`, `start_time`);
-- +end
-- +begin
CREATE UNIQUE INDEX `idx_kline_kucoin_unique`
ON kucoin_klines (`symbol`, `interval`, `start_time`);
-- +end
-- +begin
CREATE UNIQUE INDEX `idx_kline_okex_unique`
ON okex_klines (`symbol`, `interval`, `start_time`);
-- +end -- +end
-- +down -- +down
-- +begin -- +begin
SELECT 'down SQL query'; DROP INDEX `idx_kline_ftx_unique` ON `ftx_klines`;
-- +end
-- +begin
DROP INDEX `idx_kline_max_unique` ON `max_klines`;
-- +end
-- +begin
DROP INDEX `idx_kline_binance_unique` ON `binance_klines`;
-- +end
-- +begin
DROP INDEX `idx_kline_kucoin_unique` ON `kucoin_klines`;
-- +end
-- +begin
DROP INDEX `idx_kline_okex_unique` ON `okex_klines`;
-- +end -- +end