Hotfix: patch HasColumns again #171
Merged
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.
What did this pull request do?
Patch my previous PR (I tried to solve check constraints, but unfortunately broke the foreign keys). I am very sorry for that. This time I have tested it thoroughly within a large DB design instead of a small 1 table setup for just 1 use-case.
User Case Description
My previous PR fixed the logic for check constraints. However, this function was apparently also being used for foreign keys.
I tested the previous MR with a very simple table setup with 1 check constraint, without any other constraints.
Now when I implemented this new version into the large eco-system that I'm working on, it failed for foreign keys.
Apparently this function needs to be able to check if a foreign key and/or check constraint does already exist.
I looked up another example in another drive (postgres driver), in which it is possible to just check it in one table (all constraints are stored in the same table). However, within SQL server this is apparently not the case. This is why I have updated the query to check both tables.