feat(migrate): add lifecycle commands and standalone authoring (#18)
Add apply/require startup policies and five database-only migration commands. Provide standalone corestack-goose creation and reconciliation with fresh provider-local Go registrations. Default optional --dir to the working directory. Document the production boundary and source recovery requirements. Closes #9
This commit was merged in pull request #18.
This commit is contained in:
1 parent
0034a561ba
commit
a99e364ac3
12 files changed
+1678
-30
No files matched your search
@@ -0,0 +1,40 @@
|
||||
// Command corestack-goose authors provider-local SQL and Go migrations offline.
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
urfavecli "github.com/urfave/cli/v3"
|
||||
"go.auvem.com/corestack/cmd/corestack-goose/internal/authoring"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := command().Run(context.Background(), os.Args); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func command() *urfavecli.Command {
|
||||
root := &urfavecli.Command{Name: "corestack-goose", Usage: "Author migrations before deployment"}
|
||||
for _, name := range []string{"create", "fix"} {
|
||||
root.Commands = append(root.Commands, &urfavecli.Command{Name: name,
|
||||
Flags: []urfavecli.Flag{&urfavecli.StringFlag{Name: "dir", Value: ".", Usage: "Migration directory (defaults to the current working directory)"}},
|
||||
Action: func(_ context.Context, cmd *urfavecli.Command) error {
|
||||
if name == "create" {
|
||||
if cmd.NArg() != 2 {
|
||||
return fmt.Errorf("usage: create [--dir <dir>] <name> sql|go")
|
||||
}
|
||||
return authoring.Create(cmd.String("dir"), cmd.Args().Get(0), cmd.Args().Get(1))
|
||||
}
|
||||
if cmd.NArg() != 0 {
|
||||
return fmt.Errorf("usage: fix [--dir <dir>]")
|
||||
}
|
||||
return authoring.Fix(cmd.String("dir"))
|
||||
},
|
||||
})
|
||||
}
|
||||
return root
|
||||
}
|
||||
Reference in new issue
Block a user