Skip to content

Commit 70937d3

Browse files
authored
Improve docs for migration attrs (#551)
1 parent 1615d79 commit 70937d3

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

lib/ecto/migration.ex

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff 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`

0 commit comments

Comments
 (0)