mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 09:20:55 +00:00
update the migrations
This commit is contained in:
parent
f98b1810ab
commit
d2119f715c
@ -148,6 +148,7 @@ func Upgrade(lasttime int64) error {
|
||||
}
|
||||
}
|
||||
beego.Info("total success upgrade:", i, " migration")
|
||||
time.Sleep(2 * time.Second)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -163,6 +164,7 @@ func Rollback(name string) error {
|
||||
return err
|
||||
}
|
||||
beego.Info("end rollback")
|
||||
time.Sleep(2 * time.Second)
|
||||
return nil
|
||||
} else {
|
||||
return errors.New("not exist the migrationMap name:" + name)
|
||||
@ -176,6 +178,7 @@ func Reset() error {
|
||||
for k, v := range migrationMap {
|
||||
if isRollBack(k) {
|
||||
beego.Info("skip the", k)
|
||||
time.Sleep(1 * time.Second)
|
||||
continue
|
||||
}
|
||||
beego.Info("start reset:", k)
|
||||
@ -189,6 +192,7 @@ func Reset() error {
|
||||
beego.Info("end reset:", k)
|
||||
}
|
||||
beego.Info("total success reset:", i, " migration")
|
||||
time.Sleep(2 * time.Second)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -242,7 +246,7 @@ func sortMap(m map[string]Migrationer) dataSlice {
|
||||
func isRollBack(name string) bool {
|
||||
o := orm.NewOrm()
|
||||
var maps []orm.Params
|
||||
num, err := o.Raw("select * from migrations where `name` = ? order by id desc", name).Values(&maps)
|
||||
num, err := o.Raw("select * from migrations where `name` = ? order by id_migration desc", name).Values(&maps)
|
||||
if err != nil {
|
||||
beego.Info("get name has error", err)
|
||||
return false
|
||||
|
Loading…
Reference in New Issue
Block a user