I would like to understand the argument that lead to the fact that indexes associated with constraints (primary keys, foreign keys and unique constraints) are explicitly defined on the code to be interpreted as not a change and consequently no be a part of the ChangeLogFile and therefore no SQL is generated for such differences.
I’ve noticed this behaviour when comparing one database with a reference one. The reference one as explicitly defined indexes for each constraint. This way, one has more control over the model, having the possibility of defining index names and specific location for storage.
In my example, I have on my reference database a table XXX with an index xxx_fk1 and a foreign key xxx_fk1 and nothing on the same table of the compared database. The “diffChangeLog” command only outputs the creation of the foreign key xxx_fk1.
After analysis of the code, I noticed that the “DiffResult” class is the responsible for this behaviour because while iterates through all the changes, it goes out of the loop if the change is an index associated with such constraint types. Removing this logic and executing again liquibase with the “diffChangeLog” command creates output both fot he creation of the index and subsequently the foreign key.
So, assuming that there is a specific reason for this behaviour, I would like to ask how can I override or extend this implementation. From what I’ve read and understand on the Extensions documentation, it’s only possible to think in extend or override the liquibase starting from the changelog file and this tweak I want to make its before this stage. So how can it be done?
Thank you very much for your support.