feat: 更新模块路径为 v2,修正文档和代码中的相关引用
This commit is contained in:
@@ -3,24 +3,24 @@ package cmd
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.ipao.vip/atomctl/pkg/postgres"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/pressly/goose/v3"
|
||||
"github.com/samber/lo"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
"go.ipao.vip/atomctl/v2/pkg/postgres"
|
||||
)
|
||||
|
||||
// migrate
|
||||
func CommandMigrate(root *cobra.Command) {
|
||||
cmd := &cobra.Command{
|
||||
Use: "migrate [up|up-by-one|up-to|create|down|down-to|fix|redo|reset|status|version]",
|
||||
Aliases: []string{"m"},
|
||||
RunE: commandMigrate,
|
||||
}
|
||||
cmd.Flags().StringP("config", "c", "config.toml", "database config file")
|
||||
cmd.Flags().String("dir", "database/migrations", "migrations directory")
|
||||
cmd.Flags().String("table", "migrations", "migrations table name")
|
||||
cmd := &cobra.Command{
|
||||
Use: "migrate [up|up-by-one|up-to|create|down|down-to|fix|redo|reset|status|version]",
|
||||
Aliases: []string{"m"},
|
||||
RunE: commandMigrate,
|
||||
}
|
||||
cmd.Flags().StringP("config", "c", "config.toml", "database config file")
|
||||
cmd.Flags().String("dir", "database/migrations", "migrations directory")
|
||||
cmd.Flags().String("table", "migrations", "migrations table name")
|
||||
|
||||
root.AddCommand(cmd)
|
||||
}
|
||||
@@ -41,13 +41,13 @@ func commandMigrate(cmd *cobra.Command, args []string) error {
|
||||
return errors.Wrap(err, "get db")
|
||||
}
|
||||
|
||||
action, args := args[0], args[1:]
|
||||
log.Infof("migration action: %s args: %+v", action, args)
|
||||
action, args := args[0], args[1:]
|
||||
log.Infof("migration action: %s args: %+v", action, args)
|
||||
|
||||
dir := cmd.Flag("dir").Value.String()
|
||||
table := cmd.Flag("table").Value.String()
|
||||
dir := cmd.Flag("dir").Value.String()
|
||||
table := cmd.Flag("table").Value.String()
|
||||
|
||||
goose.SetTableName(table)
|
||||
goose.SetTableName(table)
|
||||
|
||||
return goose.RunContext(context.Background(), action, db, dir, args...)
|
||||
return goose.RunContext(context.Background(), action, db, dir, args...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user