1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- package version
- import (
- "runtime"
- "gorm.io/gorm"
- "git.cestong.com.cn/cecf/hx-admin-server/cmd/migrate/migration"
- "git.cestong.com.cn/cecf/hx-admin-server/cmd/migrate/migration/models"
- common "git.cestong.com.cn/cecf/hx-admin-server/common/models"
- )
- func init() {
- _, fileName, _, _ := runtime.Caller(0)
- migration.Migrate.SetVersion(migration.GetFilename(fileName), _1599190683659Tables)
- }
- func _1599190683659Tables(db *gorm.DB, version string) error {
- return db.Transaction(func(tx *gorm.DB) error {
- err := tx.Debug().Migrator().AutoMigrate(
- new(models.CasbinRule),
- new(models.SysDept),
- new(models.SysConfig),
- new(models.SysTables),
- new(models.SysColumns),
- new(models.SysMenu),
- new(models.SysLoginLog),
- new(models.SysOperaLog),
- new(models.SysRoleDept),
- new(models.SysUser),
- new(models.SysRole),
- new(models.SysPost),
- new(models.DictData),
- new(models.DictType),
- new(models.SysJob),
- new(models.SysConfig),
- new(models.SysApi),
- new(models.TbDemo),
- )
- if err != nil {
- return err
- }
- if err := models.InitDb(tx); err != nil {
- }
- return tx.Create(&common.Migration{
- Version: version,
- }).Error
- })
- }
|