skeema / tengo

Go La Tengo: a MySQL automation library
Apache License 2.0
27 stars 19 forks source link

Table.Diff(): Support re-ordering indexes #8

Closed evanelias closed 6 years ago

evanelias commented 6 years ago

Previously, when diff'ing tables, Go La Tengo did not consider secondary index order to be significant; usually it has no functional impact in MySQL/InnoDB. However, this caused two rare problems:

This PR makes Table.Diff() able to maintain index ordering. By default, however, the generated TableDiff.Statement() will automatically strip out index operations that simply reorder indexes -- preserving the previous behavior, as this generates a faster-to-execute set of ALTERs by avoiding needlessly recreated indexes whose definitions have not changed. The index reordering operations are only used in two cases: whenever index order is actually relevant (2nd bullet above), or whenever the new option StatementModifiers.StrictIndexOrder is true.

coveralls commented 6 years ago

Pull Request Test Coverage Report for Build 38


Totals Coverage Status
Change from base Build 32: 0.9%
Covered Lines: 1554
Relevant Lines: 1759

💛 - Coveralls