Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: move declarative to root (#17192)
p0ny4259b14b5326
diff --git a/action/command/check.go b/action/command/check.goindex e3fae60878..8dd8fff9cd 100644--- a/action/command/check.go+++ b/action/command/check.go@@ -53,7 +53,7 @@ func runCheck(w *world.World) func(*cobra.Command, []string) error {// Check version compatibilitycheckVersionCompatibility(w, client, args.Version)- releaseFiles, _, err := getReleaseFiles(w, w.FilePattern)+ releaseFiles, _, err := getReleaseFiles(w)if err != nil {return err}diff --git a/action/command/file.go b/action/command/file.goindex 709ebbf699..8447fda70e 100644--- a/action/command/file.go+++ b/action/command/file.go@@ -16,13 +16,13 @@ import ()// getReleaseFiles returns the release files and the digest of the release.-func getReleaseFiles(w *world.World, pattern string) ([]*v1pb.Release_File, string, error) {- matches, err := filepath.Glob(pattern)+func getReleaseFiles(w *world.World) ([]*v1pb.Release_File, string, error) {+ matches, err := filepath.Glob(w.FilePattern)if err != nil {return nil, "", err}if len(matches) == 0 {- return nil, "", errors.Errorf("no files found for pattern: %s", pattern)+ return nil, "", errors.Errorf("no files found for pattern: %s", w.FilePattern)}slices.Sort(matches)@@ -48,7 +48,7 @@ func getReleaseFiles(w *world.World, pattern string) ([]*v1pb.Release_File, strireturn []*v1pb.Release_File{{// use file pattern as the path- Path: pattern,+ Path: w.FilePattern,Type: v1pb.Release_File_DECLARATIVE,Version: w.CurrentTime.Format("20060102.150405"),ChangeType: v1pb.Release_File_DDL,diff --git a/action/command/rollout.go b/action/command/rollout.goindex 92ca9d078d..0ff75d6a86 100644--- a/action/command/rollout.go+++ b/action/command/rollout.go@@ -32,7 +32,6 @@ func NewRolloutCommand(w *world.World) *cobra.Command {cmdRollout.Flags().StringVar(&w.CheckPlan, "check-plan", "SKIP", "Whether to check the plan and fail on warning/error. Valid values: SKIP, FAIL_ON_WARNING, FAIL_ON_ERROR")cmdRollout.Flags().StringVar(&w.TargetStage, "target-stage", "", "Rollout up to the target stage. Format: environments/{environment}.")cmdRollout.Flags().StringVar(&w.Plan, "plan", "", "The plan to rollout. Format: projects/{project}/plans/{plan}. Shadows file-pattern and targets.")- cmdRollout.Flags().BoolVar(&w.Declarative, "declarative", false, "Whether to use declarative mode.")return cmdRollout}@@ -78,7 +77,7 @@ func runRollout(w *world.World) func(command *cobra.Command, _ []string) error {w.Logger.Info("use the provided plan", "url", fmt.Sprintf("%s/%s", client.url, plan.Name))} else {var release string- releaseFiles, releaseDigest, err := getReleaseFiles(w, w.FilePattern)+ releaseFiles, releaseDigest, err := getReleaseFiles(w)if err != nil {return errors.Wrapf(err, "failed to get release files")}diff --git a/action/command/root.go b/action/command/root.goindex 3701a4127e..aff69a27ea 100644--- a/action/command/root.go+++ b/action/command/root.go@@ -32,6 +32,7 @@ func NewRootCommand(w *world.World) *cobra.Command {cmd.PersistentFlags().StringVar(&w.Project, "project", "projects/hr", "Bytebase project")cmd.PersistentFlags().StringSliceVar(&w.Targets, "targets", []string{"instances/test-sample-instance/databases/hr_test", "instances/prod-sample-instance/databases/hr_prod"}, "Bytebase targets. Either one or more databases or a single databaseGroup")cmd.PersistentFlags().StringVar(&w.FilePattern, "file-pattern", "", "File pattern to glob migration files")+ cmd.PersistentFlags().BoolVar(&w.Declarative, "declarative", false, "Whether to use declarative mode.")cmd.AddCommand(NewCheckCommand(w))cmd.AddCommand(NewRolloutCommand(w))diff --git a/action/world/world.go b/action/world/world.goindex a90d5d75bf..f6f38c1f13 100644--- a/action/world/world.go+++ b/action/world/world.go@@ -19,6 +19,8 @@ type World struct {Project string // projects/{project}Targets []stringFilePattern string+ // Whether to use declarative mode.+ Declarative bool// bytebase-action check flags// An enum to determine should we fail on warning or error.@@ -40,8 +42,6 @@ type World struct {// Format: environments/{environment}TargetStage stringPlan string- // Whether to use declarative mode.- Declarative boolOutputMap map[string]string}