diff --git a/cmd/pg-schema-diff/plan_cmd.go b/cmd/pg-schema-diff/plan_cmd.go index f817ce2..a1504ae 100644 --- a/cmd/pg-schema-diff/plan_cmd.go +++ b/cmd/pg-schema-diff/plan_cmd.go @@ -85,7 +85,8 @@ type ( schemaFlags schemaFlags - dataPackNewTables bool + dataPackNewTables bool + disablePlanValidation bool statementTimeoutModifiers []string lockTimeoutModifiers []string @@ -124,6 +125,8 @@ func createPlanFlags(cmd *cobra.Command) *planFlags { schemaFlagsVar(cmd, &flags.schemaFlags) cmd.Flags().BoolVar(&flags.dataPackNewTables, "data-pack-new-tables", true, "If set, will data pack new tables in the plan to minimize table size (re-arranges columns).") + cmd.Flags().BoolVar(&flags.disablePlanValidation, "disable-plan-validation", false, "If set, will disable plan validation. Plan validation runs the migration against a temporary"+ + "database with an identical schema to the original, asserting that the generated plan actually migrates the schema to the desired target.") timeoutModifierFlagVar(cmd, &flags.statementTimeoutModifiers, "statement", "t") timeoutModifierFlagVar(cmd, &flags.lockTimeoutModifiers, "lock", "l") @@ -178,6 +181,9 @@ func parsePlanConfig(p planFlags) (planConfig, error) { if p.dataPackNewTables { opts = append(opts, diff.WithDataPackNewTables()) } + if p.disablePlanValidation { + opts = append(opts, diff.WithDoNotValidatePlan()) + } var statementTimeoutModifiers []timeoutModifier for _, s := range p.statementTimeoutModifiers {