Remove newer database check
This commit is contained in:
parent
fdc83faba0
commit
0e43d5ed69
@ -21,9 +21,6 @@ const DefaultTableName = `version`
|
|||||||
// ErrUpdatesMissing indicates an update is missing, making it impossible to execute the migration
|
// ErrUpdatesMissing indicates an update is missing, making it impossible to execute the migration
|
||||||
var ErrUpdatesMissing = errors.New(`Missing migration files`)
|
var ErrUpdatesMissing = errors.New(`Missing migration files`)
|
||||||
|
|
||||||
// ErrDatabaseNewer indicates that the database version is newer than the requested version. We throw an error because downgrades might cause dataloss
|
|
||||||
var ErrDatabaseNewer = errors.New(`Current version is newer than the requested version`)
|
|
||||||
|
|
||||||
const fileFormat = `%04d.sql`
|
const fileFormat = `%04d.sql`
|
||||||
|
|
||||||
// AssetFunc is a function that returns the data for the given name
|
// AssetFunc is a function that returns the data for the given name
|
||||||
@ -69,10 +66,6 @@ func Migrate(db *sql.DB, version int, o Options, asset AssetFunc) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if v > version {
|
|
||||||
return ErrDatabaseNewer
|
|
||||||
}
|
|
||||||
|
|
||||||
for i := v + 1; i <= version; i++ {
|
for i := v + 1; i <= version; i++ {
|
||||||
script, err := asset(fmt.Sprintf(o.AssetPrefix+fileFormat, i))
|
script, err := asset(fmt.Sprintf(o.AssetPrefix+fileFormat, i))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user