Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLI] Add flag to disable plan validation #130

Merged
merged 1 commit into from
May 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading