mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 03:16:45 +01:00
Insert ETH as HistoryDB token
This commit is contained in:
@@ -3,6 +3,9 @@ package test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/gobuffalo/packr/v2"
|
||||
"github.com/jmoiron/sqlx"
|
||||
migrate "github.com/rubenv/sql-migrate"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -21,3 +24,19 @@ func AssertUSD(t *testing.T, expected, actual *float64) {
|
||||
}
|
||||
*expected = *actual
|
||||
}
|
||||
|
||||
// WipeDB redo all the migrations of the SQL DB (HistoryDB and L2DB),
|
||||
// efectively recreating the original state
|
||||
func WipeDB(db *sqlx.DB) {
|
||||
migrations := &migrate.PackrMigrationSource{
|
||||
Box: packr.New("hermez-db-migrations", "../db/migrations"),
|
||||
}
|
||||
_, err := migrate.Exec(db.DB, "postgres", migrations, migrate.Down)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
_, err = migrate.Exec(db.DB, "postgres", migrations, migrate.Up)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user