UniqueConstraintSnapshotGenerator - Add table name to OracleDB query #2139
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.
Environment
Liquibase Version: 4.5.0
Liquibase Integration & Version: <Pick one: CLI, maven, gradle, spring boot, servlet, etc.>
Liquibase Extension(s) & Version:
Database Vendor & Version:
Operating System Type & Version:
Pull Request Type
Description
The query that is generated when retrieving all keys (ORACLE DB) does not get a table name, while the code that creates the map for the cache gets this name from the query result, which is always null. When reading the cache, the table name is used which results in the cache always returning an empty result.
Steps To Reproduce
List the steps to reproduce the behavior.
Liquibase maven executions:
Actual Behavior
Query result will preapre cache key like that:
in above
row.get("TABLE_NAME")
is always NULL, as a result we have the effect as if no keys (Unique constraints) exist, which causes that they are added to the diff file and they should not because in fact they exist in DB.Expected/Desired Behavior
Table name should be added to sql query. Then cache key will contain it and later when cache is used and table name will be given unique constraint will be read from cache.
Dev Handoff Notes (Internal Use)
Links
Testing
Dev Verification
Reviewed code and saw automated tests pass
Test Requirements (Liquibase Internal QA)
Setup
You will need two Oracle database instances.
On the first instance execute next sql script
Execute
liquibase generate-changelog --changelog-file lb2206-generated.xml --diff-types tables,columns,uniqueconstraints,data
Execute
uptade
against second instance:liquibase generate-changelog --changelog-file lb2206-generated.xml
Make sure that second database instance was populated correctly.
Manual Tests
Verify diff shows no difference in unique constraints.
liquibase diff
Verify diff-changelog doesn’t ganerate any changes to unique constraints.
liquibase diff-changelog --changelog-file lb2206-diff.xml
Automated Tests
No new functional tests required for this fix.
┆Issue is synchronized with this Jira Bug by Unito