Skip to content

Commit 6319a93

Browse files
Add flag to disable plan validation (#130)
1 parent b1bd977 commit 6319a93

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmd/pg-schema-diff/plan_cmd.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ type (
8585

8686
schemaFlags schemaFlags
8787

88-
dataPackNewTables bool
88+
dataPackNewTables bool
89+
disablePlanValidation bool
8990

9091
statementTimeoutModifiers []string
9192
lockTimeoutModifiers []string
@@ -124,6 +125,8 @@ func createPlanFlags(cmd *cobra.Command) *planFlags {
124125
schemaFlagsVar(cmd, &flags.schemaFlags)
125126

126127
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).")
128+
cmd.Flags().BoolVar(&flags.disablePlanValidation, "disable-plan-validation", false, "If set, will disable plan validation. Plan validation runs the migration against a temporary"+
129+
"database with an identical schema to the original, asserting that the generated plan actually migrates the schema to the desired target.")
127130

128131
timeoutModifierFlagVar(cmd, &flags.statementTimeoutModifiers, "statement", "t")
129132
timeoutModifierFlagVar(cmd, &flags.lockTimeoutModifiers, "lock", "l")
@@ -178,6 +181,9 @@ func parsePlanConfig(p planFlags) (planConfig, error) {
178181
if p.dataPackNewTables {
179182
opts = append(opts, diff.WithDataPackNewTables())
180183
}
184+
if p.disablePlanValidation {
185+
opts = append(opts, diff.WithDoNotValidatePlan())
186+
}
181187

182188
var statementTimeoutModifiers []timeoutModifier
183189
for _, s := range p.statementTimeoutModifiers {

0 commit comments

Comments
 (0)