mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
Compare commits
1 Commits
a6c1337493
...
6a803d5a4c
Author | SHA1 | Date | |
---|---|---|---|
|
6a803d5a4c |
|
@ -1,10 +0,0 @@
|
|||
-- +up
|
||||
-- +begin
|
||||
CREATE INDEX positions_traded_at ON positions (traded_at, profit);
|
||||
-- +end
|
||||
|
||||
-- +down
|
||||
|
||||
-- +begin
|
||||
DROP INDEX positions_traded_at ON positions;
|
||||
-- +end
|
|
@ -1,10 +0,0 @@
|
|||
-- +up
|
||||
-- +begin
|
||||
CREATE INDEX positions_traded_at ON positions (traded_at, profit);
|
||||
-- +end
|
||||
|
||||
-- +down
|
||||
|
||||
-- +begin
|
||||
DROP INDEX positions_traded_at;
|
||||
-- +end
|
|
@ -1,29 +0,0 @@
|
|||
package mysql
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/c9s/rockhopper/v2"
|
||||
)
|
||||
|
||||
func init() {
|
||||
AddMigration("main", up_main_addPositionIndex, down_main_addPositionIndex)
|
||||
}
|
||||
|
||||
func up_main_addPositionIndex(ctx context.Context, tx rockhopper.SQLExecutor) (err error) {
|
||||
// This code is executed when the migration is applied.
|
||||
_, err = tx.ExecContext(ctx, "CREATE INDEX positions_traded_at ON positions (traded_at, profit);")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func down_main_addPositionIndex(ctx context.Context, tx rockhopper.SQLExecutor) (err error) {
|
||||
// This code is executed when the migration is rolled back.
|
||||
_, err = tx.ExecContext(ctx, "DROP INDEX positions_traded_at ON positions;")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
package sqlite3
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/c9s/rockhopper/v2"
|
||||
)
|
||||
|
||||
func init() {
|
||||
AddMigration("main", up_main_addPositionIndex, down_main_addPositionIndex)
|
||||
}
|
||||
|
||||
func up_main_addPositionIndex(ctx context.Context, tx rockhopper.SQLExecutor) (err error) {
|
||||
// This code is executed when the migration is applied.
|
||||
_, err = tx.ExecContext(ctx, "CREATE INDEX positions_traded_at ON positions (traded_at, profit);")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func down_main_addPositionIndex(ctx context.Context, tx rockhopper.SQLExecutor) (err error) {
|
||||
// This code is executed when the migration is rolled back.
|
||||
_, err = tx.ExecContext(ctx, "DROP INDEX positions_traded_at;")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
Loading…
Reference in New Issue
Block a user