MINOR: Fix Table constraint relationships for SoftDeleted entities. #19129
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently
Soft Delete
andConstraints
do not fare well together and on different scenarios it errors.An example is our E2E MySQL Pipeline where we:
Some of those tables have different Foreign Key constraints and the process is currently erroring for a couple tables due to two different methods being called:
Here the
addConstraintRelationship
gets called and searches for the Foreign Key table, which was already soft deleted, raising an exception.Here the
validateTableConstraints
gets called and validates the Foreign Key table, which is still soft deleted, raising an exception.This PR fixes the issues by changing the filter to look also for soft deleted tables both within
addConstraintRelationship
andvalidateTableConstraints
. I think it makes sense to keep the constraint if there's a soft deleted table in Collate, but if we don't want this or for other weird corner cases we might need to rethink how we are dealing with this flow.Type of change:
Checklist:
Fixes <issue-number>: <short explanation>