opf/openproject — pull request #1110 by ulferts (2014-04-14 07:54:44+00:00)
Title: speedup migrations by adding indices sooner

On a mid sized installations (~ 45000 tickets), the migrations tended to take hours. Adding the indices sooner should speed up migration considerably.

Noticed this when scanning through the log while migrating the installation. A "Select * from work_package_journals where journaled_id = X" took about 200ms each. I added an index while the migration was running and the time required for each select went down to 2ms.

The sum of this change does not change the database schema at all. I left the add_index_to_all_the_journals migration in place to not disturb systems that are already migrated. However, the mentioned migration is now a no op.