add configs

This commit is contained in:
yanghao05
2023-01-29 17:21:01 +08:00
parent 7151c52543
commit e07f8a67a4
11 changed files with 500 additions and 240 deletions

View File

@@ -1,12 +1,12 @@
package cmd
import (
"log"
"sort"
// init dependencies
_ "atom/database/migrations"
_ "atom/providers"
"atom/providers/logger"
"atom/container"
"atom/contracts"
@@ -52,14 +52,14 @@ var migrateUpCmd = &cobra.Command{
m := gormigrate.New(mi.DB, gormigrate.DefaultOptions, sortedMigrations(mi.Migrations))
if len(migrateToId) > 0 {
logger.Infof("migrate up to [%s]", migrateToId)
log.Printf("migrate up to [%s]\n", migrateToId)
return m.MigrateTo(migrateToId)
}
return m.Migrate()
})
},
PostRun: func(cmd *cobra.Command, args []string) {
logger.Info("BINGO! migrate up done")
log.Println("BINGO! migrate up done")
},
}
@@ -73,14 +73,14 @@ var migrateDownCmd = &cobra.Command{
m := gormigrate.New(mi.DB, gormigrate.DefaultOptions, sortedMigrations(mi.Migrations))
if len(migrateToId) > 0 {
logger.Infof("migrate down to [%s]", migrateToId)
log.Printf("migrate down to [%s]\n", migrateToId)
return m.RollbackTo(migrateToId)
}
return m.RollbackLast()
})
},
PostRun: func(cmd *cobra.Command, args []string) {
logger.Info("BINGO! migrate down done")
log.Println("BINGO! migrate down done")
},
}