File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -812,10 +812,12 @@ defmodule Ecto.Migration do
812812 utilizes advisory locks to faciliate running migrations one at a time even
813813 across multiple nodes. For example:
814814
815- # Config the Repo (PostgreSQL example)
815+ ### Config file (PostgreSQL)
816+
816817 config MyApp.Repo, migration_lock: :pg_advisory_lock
817818
818- # Migrate with your concurrent operation
819+ ### Migration file
820+
819821 defmodule MyRepo.Migrations.CreateIndexes do
820822 use Ecto.Migration
821823 @disable_ddl_transaction true
@@ -825,6 +827,11 @@ defmodule Ecto.Migration do
825827 end
826828 end
827829
830+ Alternately, you can add `@disable_migration_lock true` to your migration file.
831+ This would mean that different nodes in a multi-node setup could run the same
832+ migration at once. It is recommended to isolate your migrations to a single node
833+ when using concurrent index creation without an advisory lock.
834+
828835 ## Index types
829836
830837 When creating an index, the index type can be specified with the `:using`
You can’t perform that action at this time.
0 commit comments