Skip to content

Add --skip-not-implemented flag to gracefully handle unimplemented diffs#290

Open
braden-vh wants to merge 2 commits into
stripe:mainfrom
videahealth:skip-not-implemented-clean
Open

Add --skip-not-implemented flag to gracefully handle unimplemented diffs#290
braden-vh wants to merge 2 commits into
stripe:mainfrom
videahealth:skip-not-implemented-clean

Conversation

@braden-vh
Copy link
Copy Markdown

Summary

Adds a WithSkipNotImplemented() PlanOpt and a corresponding --skip-not-implemented CLI flag.

When enabled, any diff operation that returns ErrNotImplemented is silently skipped rather than failing the entire plan. This enables best-effort diffing of schemas that contain features pg-schema-diff does not yet fully support (e.g. privileges on partition tables, deleting partitions without dropping the parent).

Motivation

Several real-world schemas trigger ErrNotImplemented during plan generation — particularly around partitioned tables — making schema drift detection entirely unusable even when the unimplemented operations represent a small fraction of the diff. This flag provides an escape hatch while the underlying features are being implemented.

Changes

  • pkg/diff/plan_generator.go — adds skipNotImplemented bool to planOptions and exports WithSkipNotImplemented() PlanOpt
  • pkg/diff/sql_vertex_generator.gogeneratePartialGraph checks skipNotImplemented and skips rather than errors on ErrNotImplemented in all three loops (adds, deletes, alters)
  • pkg/diff/sql_generator.go — threads skipNotImplemented through schemaSQLGenerator and tableSQLVertexGenerator to all generatePartialGraph call sites
  • cmd/pg-schema-diff/plan_cmd.go — wires up --skip-not-implemented flag

Adds a `WithSkipNotImplemented()` PlanOpt and a corresponding
`--skip-not-implemented` CLI flag. When enabled, any diff operation
that returns `ErrNotImplemented` is silently skipped rather than
failing the entire plan, enabling best-effort diffing of schemas that
contain features pg-schema-diff does not yet fully support.

The check is handled in `generatePartialGraph`, the single choke point
through which all `Add`, `Delete`, and `Alter` operations flow, so no
per-generator changes are needed.
@cla-assistant
Copy link
Copy Markdown

cla-assistant Bot commented May 29, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant