diff --git a/.travis.yml b/.travis.yml index ac48e49fe..595d79af6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,4 +9,5 @@ before_script: - go get github.com/c9s/rockhopper - go mod download script: +- bash scripts/test-sqlite3-migrations.sh - go test -v ./pkg/... diff --git a/migrations/sqlite3/20200819054742_trade_index.sql b/migrations/sqlite3/20200819054742_trade_index.sql index 6ce90b1bd..e6dba452b 100644 --- a/migrations/sqlite3/20200819054742_trade_index.sql +++ b/migrations/sqlite3/20200819054742_trade_index.sql @@ -4,6 +4,6 @@ CREATE INDEX trades_symbol_fee_currency ON trades(symbol, fee_currency, traded_a CREATE INDEX trades_traded_at_symbol ON trades(traded_at, symbol); -- +down -DROP INDEX trades_symbol ON trades; -DROP INDEX trades_symbol_fee_currency ON trades; -DROP INDEX trades_traded_at_symbol ON trades; +DROP INDEX trades_symbol; +DROP INDEX trades_symbol_fee_currency; +DROP INDEX trades_traded_at_symbol; diff --git a/migrations/sqlite3/20201105092857_trades_index_fix.sql b/migrations/sqlite3/20201105092857_trades_index_fix.sql index 44f58e768..30a955406 100644 --- a/migrations/sqlite3/20201105092857_trades_index_fix.sql +++ b/migrations/sqlite3/20201105092857_trades_index_fix.sql @@ -8,9 +8,9 @@ CREATE INDEX trades_symbol_fee_currency ON trades (exchange, symbol, fee_currenc CREATE INDEX trades_traded_at_symbol ON trades (exchange, traded_at, symbol); -- +down -DROP INDEX IF EXISTS trades_symbol ON trades; -DROP INDEX IF EXISTS trades_symbol_fee_currency ON trades; -DROP INDEX IF EXISTS trades_traded_at_symbol ON trades; +DROP INDEX IF EXISTS trades_symbol; +DROP INDEX IF EXISTS trades_symbol_fee_currency; +DROP INDEX IF EXISTS trades_traded_at_symbol; CREATE INDEX trades_symbol ON trades (symbol); CREATE INDEX trades_symbol_fee_currency ON trades (symbol, fee_currency, traded_at); diff --git a/scripts/test-sqlite3-migrations.sh b/scripts/test-sqlite3-migrations.sh new file mode 100755 index 000000000..83c5b683c --- /dev/null +++ b/scripts/test-sqlite3-migrations.sh @@ -0,0 +1,2 @@ +#!/bin/bash +rm -v bbgo.sqlite3 && rockhopper --config rockhopper_sqlite.yaml up && rockhopper --config rockhopper_sqlite.yaml down --to 1