|
@ -30,54 +30,6 @@ func InitMysqlData(db *gorm.DB) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func InitMysqlTables(db *gorm.DB) { |
|
|
func InitMysqlTables(db *gorm.DB) { |
|
|
var err error |
|
|
|
|
|
err = db.AutoMigrate( |
|
|
|
|
|
model.SysApi{}, |
|
|
|
|
|
model.SysUser{}, |
|
|
|
|
|
model.ExaFile{}, |
|
|
|
|
|
model.ExaCustomer{}, |
|
|
|
|
|
model.SysBaseMenu{}, |
|
|
|
|
|
model.SysWorkflow{}, |
|
|
|
|
|
model.SysAuthority{}, |
|
|
|
|
|
model.JwtBlacklist{}, |
|
|
|
|
|
model.ExaFileChunk{}, |
|
|
|
|
|
model.SysDictionary{}, |
|
|
|
|
|
model.ExaSimpleUploader{}, |
|
|
|
|
|
model.SysOperationRecord{}, |
|
|
|
|
|
model.SysWorkflowStepInfo{}, |
|
|
|
|
|
model.SysDictionaryDetail{}, |
|
|
|
|
|
model.SysBaseMenuParameter{}, |
|
|
|
|
|
model.ExaFileUploadAndDownload{}, |
|
|
|
|
|
) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
color.Warn.Printf("[Mysql]-->初始化数据表失败,err: %v\n", err) |
|
|
|
|
|
os.Exit(0) |
|
|
|
|
|
} |
|
|
|
|
|
color.Info.Println("[Mysql]-->初始化数据表成功") |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func InitPostgresqlData(db *gorm.DB) { |
|
|
|
|
|
var err error |
|
|
|
|
|
err = InitSysApi(db) |
|
|
|
|
|
err = InitSysUser(db) |
|
|
|
|
|
err = InitExaCustomer(db) |
|
|
|
|
|
err = InitCasbinModel(db) |
|
|
|
|
|
err = InitSysAuthority(db) |
|
|
|
|
|
err = InitSysBaseMenus(db) |
|
|
|
|
|
err = InitAuthorityMenu(db) |
|
|
|
|
|
err = InitSysAuthorityMenus(db) |
|
|
|
|
|
err = InitSysDataAuthorityId(db) |
|
|
|
|
|
err = InitSysDictionaryDetail(db) |
|
|
|
|
|
err = InitExaFileUploadAndDownload(db) |
|
|
|
|
|
err = InitSysDictionaryToPostgresql(db) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
color.Error.Printf("[Postgresql]-->初始化数据失败,err: %v\n", err) |
|
|
|
|
|
os.Exit(0) |
|
|
|
|
|
} |
|
|
|
|
|
color.Info.Println("[Postgresql]-->初始化数据成功") |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func InitPostgresqlTables(db *gorm.DB) { |
|
|
|
|
|
var err error |
|
|
var err error |
|
|
if !db.Migrator().HasTable("casbin_rule") { |
|
|
if !db.Migrator().HasTable("casbin_rule") { |
|
|
err = db.Migrator().CreateTable(&gormadapter.CasbinRule{}) |
|
|
err = db.Migrator().CreateTable(&gormadapter.CasbinRule{}) |
|
@ -92,17 +44,17 @@ func InitPostgresqlTables(db *gorm.DB) { |
|
|
model.SysAuthority{}, |
|
|
model.SysAuthority{}, |
|
|
model.JwtBlacklist{}, |
|
|
model.JwtBlacklist{}, |
|
|
model.ExaFileChunk{}, |
|
|
model.ExaFileChunk{}, |
|
|
|
|
|
model.SysDictionary{}, |
|
|
model.ExaSimpleUploader{}, |
|
|
model.ExaSimpleUploader{}, |
|
|
model.SysOperationRecord{}, |
|
|
model.SysOperationRecord{}, |
|
|
model.SysWorkflowStepInfo{}, |
|
|
model.SysWorkflowStepInfo{}, |
|
|
model.SysDictionaryDetail{}, |
|
|
model.SysDictionaryDetail{}, |
|
|
model.SysBaseMenuParameter{}, |
|
|
model.SysBaseMenuParameter{}, |
|
|
model.ExaFileUploadAndDownload{}, |
|
|
model.ExaFileUploadAndDownload{}, |
|
|
SysDictionaryToPostgresql{}, |
|
|
|
|
|
) |
|
|
) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
color.Error.Printf("[Postgresql]-->初始化数据表失败,err: %v\n", err) |
|
|
|
|
|
|
|
|
color.Warn.Printf("[Mysql]-->初始化数据表失败,err: %v\n", err) |
|
|
os.Exit(0) |
|
|
os.Exit(0) |
|
|
} |
|
|
} |
|
|
color.Info.Println("[Postgresql]-->初始化数据表成功") |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
color.Info.Println("[Mysql]-->初始化数据表成功") |
|
|
|
|
|
} |