fix app load order
This commit is contained in:
parent
d9caff2c38
commit
8fa2693ae4
@ -30,7 +30,6 @@ var dsnCommand = &cobra.Command{
|
|||||||
Long: "生成 DSN",
|
Long: "生成 DSN",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
config.InitConfig()
|
config.InitConfig()
|
||||||
|
|
||||||
fmt.Print(config.Config.DB.Driver + "://" + config.Config.DB.DSN)
|
fmt.Print(config.Config.DB.Driver + "://" + config.Config.DB.DSN)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -41,8 +40,8 @@ var migrateCommand = &cobra.Command{
|
|||||||
Long: "适用于生产环境的数据库迁移",
|
Long: "适用于生产环境的数据库迁移",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
config.InitConfig()
|
config.InitConfig()
|
||||||
ent.InitEnt()
|
|
||||||
logger.InitLogger()
|
logger.InitLogger()
|
||||||
|
ent.InitEnt()
|
||||||
RunMigrate()
|
RunMigrate()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -53,8 +52,8 @@ var createMigrateCommand = &cobra.Command{
|
|||||||
Long: "从 internal/ent 中新建迁移。在这之前,需要运行 go generate ./internal/ent",
|
Long: "从 internal/ent 中新建迁移。在这之前,需要运行 go generate ./internal/ent",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
config.InitConfig()
|
config.InitConfig()
|
||||||
ent.InitEnt()
|
|
||||||
logger.InitLogger()
|
logger.InitLogger()
|
||||||
|
ent.InitEnt()
|
||||||
generateMigration()
|
generateMigration()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user