Skip to main content

Module constraints

Module constraints 

Source
Expand description

Constraint-level diffing inside an AlterTable.

Pairs constraints by QualifiedName. v0.1 emits only AddConstraint, DropConstraint, and SetConstraintComment: any change to the definition of an existing constraint is expressed as a drop-then-add pair, since Postgres does not support most ALTER ... CONSTRAINT operations.

§Destructiveness

  • AddConstraint(...): Safe. The rewrite pass converts FK adds to NOT VALID + VALIDATE for online behavior.
  • DropConstraint: conservatively RequiresApproval for every kind. We may relax CHECK / UNIQUE drops to Safe in a future pass once we have experience with users.
  • SetConstraintComment: Safe.

Functions§

diff_constraints
Diff constraints in target against source, appending entries to out.