@@ -180,40 +180,60 @@ defmodule Ecto.Migration do
180180 To avoid that we recommend to use `execute/2` with anonymous functions instead.
181181 For more information and example usage please take a look at `execute/2` function.
182182
183- ## Comments
184-
185- Migrations where you create or alter a table support specifying table
186- and column comments. The same can be done when creating constraints
187- and indexes. Not all databases support this feature.
188-
189- def up do
190- create index("posts", [:name], comment: "Index Comment")
191- create constraint("products", "price_must_be_positive", check: "price > 0", comment: "Constraint Comment")
192- create table("weather", prefix: "north_america", comment: "Table Comment") do
193- add :city, :string, size: 40, comment: "Column Comment"
194- timestamps()
195- end
196- end
197-
198183 ## Repo configuration
199184
200- The following migration configuration options are available for a given repository:
185+ ### Migrator configuration
186+
187+ These options configure how the underlying migration engine works:
201188
202189 * `:migration_source` - Version numbers of migrations will be saved in a
203190 table named `schema_migrations` by default. You can configure the name of
204191 the table via:
205192
206193 config :app, App.Repo, migration_source: "my_migrations"
207194
195+ * `:migration_lock` - By default, Ecto will lock the migration source to throttle
196+ multiple nodes to run migrations one at a time. You can disable the `migration_lock`
197+ by setting it to `false`. You may also select a different locking strategy if
198+ supported by the adapter. See the adapter docs for more information.
199+
200+ config :app, App.Repo, migration_lock: false
201+
202+ # Or use a different locking strategy. For example, Postgres can use advisory
203+ # locks but be aware that your database configuration might not make this a good
204+ # fit. See the Ecto.Adapters.Postgres for more information:
205+ config :app, App.Repo, migration_lock: :pg_advisory_lock
206+
207+ * `:migration_repo` - The migration repository is where the table managing the
208+ migrations will be stored (`migration_source` defines the table name). It defaults
209+ to the given repository itself but you can configure it via:
210+
211+ config :app, App.Repo, migration_repo: App.MigrationRepo
212+
213+ * `:priv` - the priv directory for the repo with the location of important assets,
214+ such as migrations. For a repository named `MyApp.FooRepo`, `:priv` defaults to
215+ "priv/foo_repo" and migrations should be placed at "priv/foo_repo/migrations"
216+
217+ * `:start_apps_before_migration` - A list of applications to be started before
218+ running migrations. Used by `Ecto.Migrator.with_repo/3` and the migration tasks:
219+
220+ config :app, App.Repo, start_apps_before_migration: [:ssl, :some_custom_logger]
221+
222+ ### Migrations configuration
223+
224+ These options configure how each migration works. **It is generally discouraged
225+ to change any of those configurations after your database is deployed to production,
226+ as changing these options will retroactively change how all migrations work**.
227+
208228 * `:migration_primary_key` - By default, Ecto uses the `:id` column with type
209229 `:bigserial`, but you can configure it via:
210230
211231 config :app, App.Repo, migration_primary_key: [name: :uuid, type: :binary_id]
212232
213233 config :app, App.Repo, migration_primary_key: false
214234
215- * `:migration_foreign_key` - By default, Ecto uses the migration_primary_key type
216- for foreign keys when references/2 is used, but you can configure it via:
235+ * `:migration_foreign_key` - By default, Ecto uses the `primary_key` type
236+ for foreign keys when ` references/2` is used, but you can configure it via:
217237
218238 config :app, App.Repo, migration_foreign_key: [column: :uuid, type: :binary_id]
219239
@@ -228,36 +248,25 @@ defmodule Ecto.Migration do
228248 updated_at: :changed_at
229249 ]
230250
231- * `:migration_lock` - By default, Ecto will lock the migration source to throttle
232- multiple nodes to run migrations one at a time. You can disable the `migration_lock`
233- by setting it to `false`. You may also select a different locking strategy if
234- supported by the adapter. See the adapter docs for more information.
235-
236- config :app, App.Repo, migration_lock: false
237- # Or use a different locking strategy. For example, Postgres can use advisory
238- # locks but be aware that your database configuration might not make this a good
239- # fit. See the Ecto.Adapters.Postgres for more information:
240- config :app, App.Repo, migration_lock: :pg_advisory_lock
241-
242251 * `:migration_default_prefix` - Ecto defaults to `nil` for the database prefix for
243252 migrations, but you can configure it via:
244253
245254 config :app, App.Repo, migration_default_prefix: "my_prefix"
246255
247- * `:migration_repo` - The migration repository is where the table managing the
248- migrations will be stored (`migration_source` defines the table name). It defaults
249- to the given repository itself but you can configure it via:
250-
251- config :app, App.Repo, migration_repo: App.MigrationRepo
252-
253- * `:priv` - the priv directory for the repo with the location of important assets,
254- such as migrations. For a repository named `MyApp.FooRepo`, `:priv` defaults to
255- "priv/foo_repo" and migrations should be placed at "priv/foo_repo/migrations"
256+ ## Comments
256257
257- * `:start_apps_before_migration` - A list of applications to be started before
258- running migrations. Used by `Ecto.Migrator.with_repo/3` and the migration tasks:
258+ Migrations where you create or alter a table support specifying table
259+ and column comments. The same can be done when creating constraints
260+ and indexes. Not all databases support this feature.
259261
260- config :app, App.Repo, start_apps_before_migration: [:ssl, :some_custom_logger]
262+ def up do
263+ create index("posts", [:name], comment: "Index Comment")
264+ create constraint("products", "price_must_be_positive", check: "price > 0", comment: "Constraint Comment")
265+ create table("weather", prefix: "north_america", comment: "Table Comment") do
266+ add :city, :string, size: 40, comment: "Column Comment"
267+ timestamps()
268+ end
269+ end
261270
262271 ## Prefixes
263272
0 commit comments