Fix migration script

The migration script for tag unique constraint sensitivity needs improvement:
- More generic renaming function
- Fixing broken migration in cases where more than one naming conflict exists
 (e.g. 'ab', 'Ab', and also 'AB')