MCPcopy
hub / github.com/rubenv/sql-migrate / Run

Method Run

sql-migrate/command_new.go:42–62  ·  view source on GitHub ↗
(args []string)

Source from the content-addressed store, hash-verified

40}
41
42func (c *NewCommand) Run(args []string) int {
43 cmdFlags := flag.NewFlagSet("new", flag.ContinueOnError)
44 cmdFlags.Usage = func() { ui.Output(c.Help()) }
45 ConfigFlags(cmdFlags)
46
47 if len(args) < 1 {
48 err := errors.New("A name for the migration is needed")
49 ui.Error(err.Error())
50 return 1
51 }
52
53 if err := cmdFlags.Parse(args); err != nil {
54 return 1
55 }
56
57 if err := CreateMigration(cmdFlags.Arg(0)); err != nil {
58 ui.Error(err.Error())
59 return 1
60 }
61 return 0
62}
63
64func CreateMigration(name string) error {
65 env, err := GetEnvironment()

Callers

nothing calls this directly

Calls 4

HelpMethod · 0.95
ConfigFlagsFunction · 0.85
CreateMigrationFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected