v1.27.0-a #10
@ -263,7 +263,6 @@ func (db *DB) upgrade() error {
|
|||||||
if len(dir) == 0 {
|
if len(dir) == 0 {
|
||||||
logger.Error("No sql files found.")
|
logger.Error("No sql files found.")
|
||||||
}
|
}
|
||||||
last := ""
|
|
||||||
for _, e := range dir {
|
for _, e := range dir {
|
||||||
name := e.Name()
|
name := e.Name()
|
||||||
if !strings.HasSuffix(name, ".sql") {
|
if !strings.HasSuffix(name, ".sql") {
|
||||||
@ -274,9 +273,6 @@ func (db *DB) upgrade() error {
|
|||||||
logger.Debug("DB Schema " + name + " already applied.")
|
logger.Debug("DB Schema " + name + " already applied.")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if last[:8] == name[:8] {
|
|
||||||
return xerrors.Errorf("Two files have the same date prefix: " + last + " and " + name)
|
|
||||||
}
|
|
||||||
file, err := fs.ReadFile("sql/" + name)
|
file, err := fs.ReadFile("sql/" + name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("weird embed file read err")
|
logger.Error("weird embed file read err")
|
||||||
@ -300,7 +296,6 @@ func (db *DB) upgrade() error {
|
|||||||
logger.Error("Cannot update base: " + err.Error())
|
logger.Error("Cannot update base: " + err.Error())
|
||||||
return xerrors.Errorf("cannot insert into base: %w", err)
|
return xerrors.Errorf("cannot insert into base: %w", err)
|
||||||
}
|
}
|
||||||
last = name
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user