2019-08-20 15:38:40 +00:00
|
|
|
package migrations
|
|
|
|
|
|
|
|
import (
|
|
|
|
"database/sql"
|
|
|
|
|
|
|
|
bindata "github.com/status-im/migrate/v4/source/go_bindata"
|
2020-01-02 09:10:19 +00:00
|
|
|
|
2019-08-20 15:38:40 +00:00
|
|
|
"github.com/status-im/status-go/sqlite"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Migrate applies migrations.
|
2023-05-19 15:31:45 +00:00
|
|
|
// see Migrate in vendor/status-go/sqlite/migrate.go
|
2023-08-08 06:55:13 +00:00
|
|
|
func Migrate(db *sql.DB, customSteps []*sqlite.PostStep) error {
|
2019-08-20 15:38:40 +00:00
|
|
|
return sqlite.Migrate(db, bindata.Resource(
|
|
|
|
AssetNames(),
|
|
|
|
func(name string) ([]byte, error) {
|
|
|
|
return Asset(name)
|
|
|
|
},
|
2023-05-19 15:31:45 +00:00
|
|
|
), customSteps, nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
// MigrateTo is used for testing purposes
|
2023-08-08 06:55:13 +00:00
|
|
|
func MigrateTo(db *sql.DB, customSteps []*sqlite.PostStep, untilVersion uint) error {
|
2023-05-19 15:31:45 +00:00
|
|
|
return sqlite.Migrate(db, bindata.Resource(
|
|
|
|
AssetNames(),
|
|
|
|
func(name string) ([]byte, error) {
|
|
|
|
return Asset(name)
|
|
|
|
},
|
|
|
|
), customSteps, &untilVersion)
|
2019-08-20 15:38:40 +00:00
|
|
|
}
|