Skip to content

Commit 231bfee

Browse files
author
Roman Zatonskiy
committed
added new cmd command for create a new migration
1 parent d82b676 commit 231bfee

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

internal/command/migrate_create.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ func NewMigrateCreate(ctn di.Container) *cobra.Command {
3434
RunE: func(cmd *cobra.Command, args []string) error {
3535
return ctn.Call(func(ctx context.Context, logger *zap.Logger) (err error) {
3636
var (
37-
name = args[0]
38-
path = cmd.Flag("path").Value.String()
37+
name = args[0]
38+
path = cmd.Flag("path").Value.String()
39+
fileName string
3940
)
4041
if !filepath.IsAbs(path) {
4142
var appPath, ok = ctx.Value("app.path").(string)
@@ -46,14 +47,11 @@ func NewMigrateCreate(ctn di.Container) *cobra.Command {
4647
path = filepath.Join(appPath, path)
4748
}
4849

49-
if _, err = create(path, name, migrationFileExtension); err != nil {
50+
if fileName, err = create(path, name, migrationFileExtension); err != nil {
5051
return err
5152
}
5253

53-
logger.Info(
54-
"Created migration",
55-
zap.String("migration", filepath.Join(path, name+"."+migrationFileExtension)),
56-
)
54+
logger.Info("Created migration", zap.String("migration", fileName))
5755

5856
return nil
5957
})

0 commit comments

Comments
 (0)