mirror of
https://github.com/status-im/status-go.git
synced 2025-01-09 06:12:55 +00:00
aa3d33a58f
Some functions split to be more cohesive, custom PostSteps are stored as pointers to allow their retrieval and parameters passing in runtime if needed (some extra work is dropped and TBD when needed)
31 lines
740 B
Go
31 lines
740 B
Go
package migrations
|
|
|
|
import (
|
|
"database/sql"
|
|
|
|
bindata "github.com/status-im/migrate/v4/source/go_bindata"
|
|
|
|
"github.com/status-im/status-go/sqlite"
|
|
)
|
|
|
|
// Migrate applies migrations.
|
|
// see Migrate in vendor/status-go/sqlite/migrate.go
|
|
func Migrate(db *sql.DB, customSteps []*sqlite.PostStep) error {
|
|
return sqlite.Migrate(db, bindata.Resource(
|
|
AssetNames(),
|
|
func(name string) ([]byte, error) {
|
|
return Asset(name)
|
|
},
|
|
), customSteps, nil)
|
|
}
|
|
|
|
// MigrateTo is used for testing purposes
|
|
func MigrateTo(db *sql.DB, customSteps []*sqlite.PostStep, untilVersion uint) error {
|
|
return sqlite.Migrate(db, bindata.Resource(
|
|
AssetNames(),
|
|
func(name string) ([]byte, error) {
|
|
return Asset(name)
|
|
},
|
|
), customSteps, &untilVersion)
|
|
}
|