Skip to content

Commit

Permalink
Improve docs for migration attrs (#551)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanl authored Aug 23, 2023
1 parent 1615d79 commit 70937d3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/ecto/migration.ex
Original file line number Diff line number Diff line change
Expand Up @@ -812,10 +812,12 @@ defmodule Ecto.Migration do
utilizes advisory locks to faciliate running migrations one at a time even
across multiple nodes. For example:
# Config the Repo (PostgreSQL example)
### Config file (PostgreSQL)
config MyApp.Repo, migration_lock: :pg_advisory_lock
# Migrate with your concurrent operation
### Migration file
defmodule MyRepo.Migrations.CreateIndexes do
use Ecto.Migration
@disable_ddl_transaction true
Expand All @@ -825,6 +827,11 @@ defmodule Ecto.Migration do
end
end
Alternately, you can add `@disable_migration_lock true` to your migration file.
This would mean that different nodes in a multi-node setup could run the same
migration at once. It is recommended to isolate your migrations to a single node
when using concurrent index creation without an advisory lock.
## Index types
When creating an index, the index type can be specified with the `:using`
Expand Down

0 comments on commit 70937d3

Please sign in to comment.