2018-02-02 21:53:16 +00:00
|
|
|
package postgres
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/vulcanize/vulcanizedb/pkg/config"
|
|
|
|
"github.com/vulcanize/vulcanizedb/pkg/core"
|
|
|
|
)
|
|
|
|
|
2018-02-12 16:54:05 +00:00
|
|
|
func (db *DB) clearData() {
|
|
|
|
db.MustExec("DELETE FROM watched_contracts")
|
|
|
|
db.MustExec("DELETE FROM transactions")
|
|
|
|
db.MustExec("DELETE FROM blocks")
|
|
|
|
db.MustExec("DELETE FROM logs")
|
|
|
|
db.MustExec("DELETE FROM receipts")
|
|
|
|
db.MustExec("DELETE FROM log_filters")
|
2018-02-02 21:53:16 +00:00
|
|
|
}
|
|
|
|
|
2018-02-12 16:54:05 +00:00
|
|
|
func NewTestDB(node core.Node) *DB {
|
2018-02-02 21:53:16 +00:00
|
|
|
cfg, _ := config.NewConfig("private")
|
2018-02-12 16:54:05 +00:00
|
|
|
db, _ := NewDB(cfg.Database, node)
|
|
|
|
db.clearData()
|
|
|
|
return db
|
2018-02-02 21:53:16 +00:00
|
|
|
}
|