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

Preserve CHECK constraints on duplication #244

Merged
merged 7 commits into from
Jan 19, 2024

Conversation

andrew-farries
Copy link
Collaborator

When duplicating a column for backfilling ensure that any CHECK constraints on the original column are re-created on the duplicated column. The CHECK constraint is initially created as NOT VALID then validated after migration completion.

This is part of #227

As of this PR, column properties that are preserved when duplicating a column for backfilling are:

  • DEFAULT values
  • FOREIGN KEY constraints
  • CHECK constraints

Base automatically changed from use-prefix-on-duplicated-fks to main January 19, 2024 15:08
When duplicating a column for backfilling ensure that any `check`
constraints on the original colum are applied to the duplicated column.

The `check` constraint is initially created as `NOT VALID` then
validated after migration completion.
Ensure that any `CHECK` constraints on columns duplicated for
backfilling are validated and renamed when a migration completes.
Ensure that altering a column to make it `NOT NULL` retains any check
constraints that were defined on the column.
Ensure that altering a column to add a new `CHECK` constraint preserves
existing `CHECK` constraints on the column.
Ensure that adding a foreign key constraint to a column preserves
existing `CHECK` constraints on the column.
Ensure that adding a `UNIQUE` constraint to a column preserves existing
`CHECK` constraints on the column.
@andrew-farries andrew-farries force-pushed the preserve-check-constraints-on-duplication branch from dd65a2f to d0dddda Compare January 19, 2024 15:11
@andrew-farries andrew-farries merged commit 68c5fbf into main Jan 19, 2024
24 checks passed
@andrew-farries andrew-farries deleted the preserve-check-constraints-on-duplication branch January 19, 2024 15:14
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.

None yet

2 participants