Open amirkarimi opened 8 years ago
the problem is that when index names are different, you'd have to search all indexes specified on the table whether their definition does match and then you'd have to handle the rest of the indexes that did not match anything. this implementation would be much more complicated than simple comparison of index names and their definitions. so unless someone writes the code, index renames won't be supported.
anyway, unless you need to run apgdiff in some sort of unattended batch where you cannot modify the "diff" in the process, you can simply change the DROP/CREATE to ALTER as you mentioned above and it's all you need to do.
We are encountering the following error comparing a db with a newer schema which one of it's indexes is renamed.
"Doctors_pkey" is renamed to "Advisors_pkey" in new schema. apgdiff tries to drop the old pkey and create a new one with the new name (instead of just renaming it). But the old one is referenced by other constraints. Why apgdiff doesn't just rename the constraint using the following command: