returnerrors.New("there is something wrong with data migration for table `session`, if there is a table called `session_tmp` not created by you in casdoor, please drop it, then restart anyhow")
}
err=tx.DropTable("session")
iferr!=nil{
returnerrors.New("fail to drop table `session` for casdoor, please drop it and rename the table `session_tmp` to `session` manually and restart")
}
// Already drop table `session`
// Can't find an api from xorm for altering table name
err=tx.Table("session").CreateTable(&Session{})
iferr!=nil{
returnerrors.New("there is something wrong with data migration for table `session`, please restart")
}
sessions:=[]*Session{}
tx.Table("session_tmp").Find(&sessions)
_,err=tx.Table("session").Insert(sessions)
iferr!=nil{
returnerrors.New("there is something wrong with data migration for table `session`, please drop table `session` and rename table `session_tmp` to `session` and restart")
}
err=tx.DropTable("session_tmp")
iferr!=nil{
returnerrors.New("fail to drop table `session_tmp` for casdoor, please drop it manually and restart")