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

Fix add_check_constraint when raising an error in safe mode #272

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Sep 1, 2024

  1. Fix add_check_constraint when raising an error in safe mode

    Followup to ankane#271
    
    When adding a CHECK constraint and safe mode is enabled:
    
    - we add a NOT VALID check constraint
    - then commit the transaction
    - and finally validate the check constraint in another migration.
    
    If the validation step fails, this leaves a NOT VALID check constraint
    in the database.
    If we retry after having cleaned up the database, the creation of the
    NOT VALID check constraint will fail because it will already be in the
    DB.
    
    This commit makes the migration safely retriable by checking if said
    check constraint already exists, and if so, skips its creation again.
    chaadow committed Sep 1, 2024
    Configuration menu
    Copy the full SHA
    92c92f4 View commit details
    Browse the repository at this point in the history