add script for testing sqlite3 migration

This commit is contained in:
c9s 2021-02-05 14:20:07 +08:00
parent 16b7944b92
commit ccb1708fd9
4 changed files with 9 additions and 6 deletions

View File

@ -9,4 +9,5 @@ before_script:
- go get github.com/c9s/rockhopper - go get github.com/c9s/rockhopper
- go mod download - go mod download
script: script:
- bash scripts/test-sqlite3-migrations.sh
- go test -v ./pkg/... - go test -v ./pkg/...

View File

@ -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); CREATE INDEX trades_traded_at_symbol ON trades(traded_at, symbol);
-- +down -- +down
DROP INDEX trades_symbol ON trades; DROP INDEX trades_symbol;
DROP INDEX trades_symbol_fee_currency ON trades; DROP INDEX trades_symbol_fee_currency;
DROP INDEX trades_traded_at_symbol ON trades; DROP INDEX trades_traded_at_symbol;

View File

@ -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); CREATE INDEX trades_traded_at_symbol ON trades (exchange, traded_at, symbol);
-- +down -- +down
DROP INDEX IF EXISTS trades_symbol ON trades; DROP INDEX IF EXISTS trades_symbol;
DROP INDEX IF EXISTS trades_symbol_fee_currency ON trades; DROP INDEX IF EXISTS trades_symbol_fee_currency;
DROP INDEX IF EXISTS trades_traded_at_symbol ON trades; DROP INDEX IF EXISTS trades_traded_at_symbol;
CREATE INDEX trades_symbol ON trades (symbol); CREATE INDEX trades_symbol ON trades (symbol);
CREATE INDEX trades_symbol_fee_currency ON trades (symbol, fee_currency, traded_at); CREATE INDEX trades_symbol_fee_currency ON trades (symbol, fee_currency, traded_at);

View File

@ -0,0 +1,2 @@
#!/bin/bash
rm -v bbgo.sqlite3 && rockhopper --config rockhopper_sqlite.yaml up && rockhopper --config rockhopper_sqlite.yaml down --to 1