
Moved index adding to a helper function, so that the same mistake isn't made again. That is, indexes should be the same whether upgrading or creating a database. Thus, the code to add indexes should always be the same regardless of the reason for an index being added. The `IF NOT EXISTS` syntax helps to allow the same queries to add during creatin and migration of database.