Tip for altering index in a migration

This one was a ‘well duh!’ moment for me, but if you’re going to run a


$this->createIndex

call in a migration that involves adding a uniquely keyed index to a table that’s potentially already populated, be sure to run


$this->truncateTable('tbl_name')

first. ;)

Alternately, manually ensure you have no data that would cause a key conflict already in the table…