Module: PgSaurus::CreateIndexConcurrently
- Defined in:
- lib/pg_saurus/create_index_concurrently.rb
Overview
Adds ability to configure in migration how index will be created. See more details how to create index concurrently in PostgreSQL at (see www.postgresql.org/docs/9.2/static/sql-createindex.html#SQL-CREATEINDEX-CONCURRENTLY).
There are several things you should be aware when use option to create index concurrently. Index can not be created concurrently inside transaction and such indexes creation will be postponed till migration transaction will be closed. In case of migration failure and transaction was rolled back indexes will not be created concurrently. But if indexes which should be created concurrently run with errors migration’s transaction won’t be rolled back. Error in that case will be raised and migration process will be stoped.
Migrations can not ensure that all indexes that tend to be created concurrently were created even if the query for such index creation run without errors. Such indexes creation are deferred because of its nature. So, it’s up to you to ensure that indexes was really created or remove partially created invalid indexes.
:concurrent_index option conflicts with :exclude_index option in method ‘add_foreign_key`. So, if you put them together exception will be raised.
Defined Under Namespace
Modules: Migration, MigrationProxy, Migrator