berlindb / core

All of the required core code
MIT License
253 stars 27 forks source link

Add a method to check whether a Column index already exists #37

Closed JJJ closed 4 years ago

JJJ commented 4 years ago

Similar to the column_exists() method, some database table upgrade routines would benefit from an easy & reliable way to check whether a database table column already has a specific index on it or not.

Easy Digital Downloads 3.0 specifically, has at least one upgrade method where a method (such as the one I'm proposing here) would be useful to avoid attempting adding an index where it already exists.

I've witnessed a single case of an upgrade loop occurring because this type of ALTER query fails, which does not bump the table version, etc...