Skip to content

Commit

Permalink
Add flag to disable plan validation (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
bplunkett-stripe authored May 6, 2024
1 parent b1bd977 commit 6319a93
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/pg-schema-diff/plan_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ type (

schemaFlags schemaFlags

dataPackNewTables bool
dataPackNewTables bool
disablePlanValidation bool

statementTimeoutModifiers []string
lockTimeoutModifiers []string
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 6319a93

Please sign in to comment.