Index Snapshot - doesn't include upper cased name indexes when db is NOT case sensitive
Description
Environment
Liquibase 3.3.2, MySQL 5.6
Activity
Show:
Nathan Voxland March 11, 2015 at 6:10 PM
Merged pull request

BobS February 27, 2015 at 8:51 PM
pull request #368
I have a MySQL database, where most of the objects were created with upper case names, and the db setting is for case insensitive (lower_case_table_names = true).
When I do a preConditions 'indexExists' for an index that was created upper case, the index is never foundi n the db, whether the preConditions specifies the indexName upper case or lower case.
For example, if there is an index 'CLUMP_INST_IDX' in the schema, and I have a pre-condition like this:
then the preCondition fails. Same if I specify 'clump_inst_idx' in the precondition.
I tracked it down to IndexSnapshotGenerator, which builds a Map 'foundIndexes'. The raw name from the DB ('indexName') is used when adding to the map. However, later in the method, the index to be returned is retrieved from the foundIndexes map using 'exampleName', which has been 'corrected' (passed through database.correctObjectName()), which lower-cased the example name.
The fix is to do the same 'correction' to the key used when adding to the map.