This repository has been archived on 2024-11-28. You can view files and clone it, but cannot push or open issues or pull requests.
Files
schisandra-cloud-album/cmd/db/db.go
landaiqing 331835f949 ⚗️ add bcrypt
2024-08-06 14:16:25 +08:00

27 lines
573 B
Go

package db
import (
"schisandra-cloud-album/global"
"schisandra-cloud-album/model"
)
func MakeMigration() {
var err error
global.LOG.Infof("开始迁移数据库")
err = global.DB.Set("gorm:table_options", "ENGINE=InnoDB").AutoMigrate(
&model.ScaAuthUser{},
&model.ScaAuthPermission{},
&model.ScaAuthRole{},
&model.ScaAuthRolePermission{},
&model.ScaAuthUserRole{},
&model.ScaAuthUserDevice{},
&model.ScaAuthUserSocial{},
)
if err != nil {
global.LOG.Error("数据库迁移失败: %v", err)
return
}
global.LOG.Info("数据库迁移成功")
}