Changing index columns leads to wrong output order in the change log xml file.
Description
The diff tool is incorrectly dealing with changed indices. The situation is as follows: I have an index with name index1 which applies to columns A and B. Next I would like to change this index by extending it with one extra column. So the new index configuration would be index1 applying to A, B and C. The diff tool generates the change log xml file with output:
This is clearly the wrong order. The DatabaseUpdateTask is also not capable of detecting this problem so it will end up in errors.
Environment
None
Activity
Show:
Nathan Voxland July 28, 2015 at 3:36 PM
It is working for me with the 3.4.1 codebase. It may have been fixed by another issue between 3.3.5 and 3.4.1. If you are still seeing it, run `liquibase diff` and include the output, especially for the indexes. That will better describe what liquibase is seeing and trying to fix
Nathan Voxland July 9, 2015 at 8:26 PM
I'll look at it with 3.4.1
Carl Andrews June 26, 2015 at 4:50 PM
I am getting this exact problem. SQL server 2012. Liquibase 3.3.5. CREATE INDEX comes before DROP INDEX in both xml and generated SQL
Nathan Voxland September 11, 2011 at 6:27 AM
Applied change already for another issue
JS August 24, 2011 at 11:29 AM
I think this can be easily fixed just changed the order of method calls in the DiffResult method public void printChangeLog(PrintStream out, Database targetDatabase, ChangeLogSerializer changeLogSerializer) throws ParserConfigurationException, IOException, DatabaseException
by calling method addUnexpectedIndexChanges(changeSets) before calling method addMissingIndexChanges(changeSets).
The diff tool is incorrectly dealing with changed indices. The situation is as follows:
I have an index with name index1 which applies to columns A and B.
Next I would like to change this index by extending it with one extra column. So the new index configuration would be index1 applying to A, B and C.
The diff tool generates the change log xml file with output:
<createIndex indexName="index1" tableName="table">
<column name="A"/>
<column name="B"/>
<column name="C"/>
</createIndex>
<dropIndex indexName="index1" schemaName="dbSchema" tableName="table"/>
This is clearly the wrong order. The DatabaseUpdateTask is also not capable of detecting this problem so it will end up in errors.