Fix search-replace for tables with composite primary keys #183
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.
Fixes #182
This PR addresses two bugs:
There are three commits under this PR. The first adds tests that will fail until the next two commits are applied. Please note that number of rows INSERTed for testing with composite primary keys is intentionally different than the number of rows used to test with single primary keys. The idea is to avoid symmetry to reduce the likelihood of the total count accidentally matching due to some other bug (e.g., a bug where composite key rows aren't replaced at all but single key rows are counted twice).
Perhaps it would be good to separate single key and composite key into dedicated scenarios, but so far, I have simply updated the precise and regex batch scenarios to also test with composite primary keys.
To test:
git revert --no-commit HEAD HEAD~1
to temporarily reverse both fixescomposer test
and observe the failures due to SQL syntax errorsgit revert --abort
git revert --no-commit HEAD
to temporarily reverse the second fixcomposer test
and observe that the total number of replacements is 3000 rather than the expected total of 4050.git revert --abort
composer test
and note that all tests pass