Skip to content

Commit

Permalink
add script for testing sqlite3 migration
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Feb 5, 2021
1 parent 16b7944 commit ccb1708
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/...
6 changes: 3 additions & 3 deletions migrations/sqlite3/20200819054742_trade_index.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;
6 changes: 3 additions & 3 deletions migrations/sqlite3/20201105092857_trades_index_fix.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions scripts/test-sqlite3-migrations.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
rm -v bbgo.sqlite3 && rockhopper --config rockhopper_sqlite.yaml up && rockhopper --config rockhopper_sqlite.yaml down --to 1

0 comments on commit ccb1708

Please sign in to comment.