Rubocop to separate concurrent migration helpers in their own migration
We should not mix concurrent migration helpers with normal migration steps and detect this situation with a rubocop (it happens quite often).
The reason for this is that concurrent migration helpers require the transaction scope to be disabled with disable_ddl_transaction!
for the migration (otherwise a CREATE INDEX CONCURRENTLY
fails). The concurrent migration helpers can fail on their own and are built to be retried (ie add_concurrent_index
first checks if the index already exists).
On a migration failure, any previous normal migration step included is not going to be rolled back, leaving back whatever change was made. On migration retry, this step is bound to fail.
- Detect situation with rubocop
- Update documentation with an explanation (and let the rubocop failure point to it if possible)
Edited by Andreas Brandl