Skip to content

Commit c8b9c57

Browse files
authored
Add more docs about migration timestamps (#358)
Co-authored-by: c4710n <[email protected]>
1 parent 28b75ae commit c8b9c57

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

lib/ecto/migration.ex

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,16 @@ defmodule Ecto.Migration do
217217
218218
config :app, App.Repo, migration_foreign_key: [column: :uuid, type: :binary_id]
219219
220-
* `:migration_timestamps` - By default, Ecto uses the `:naive_datetime` type, but
221-
you can configure it via:
220+
* `:migration_timestamps` - By default, Ecto uses the `:naive_datetime` as the type,
221+
`:inserted_at` as the name of the column for storing insertion times, `:updated_at` as
222+
the name of the column for storing last-updated-at times, but you can configure it
223+
via:
222224
223-
config :app, App.Repo, migration_timestamps: [type: :utc_datetime]
225+
config :app, App.Repo, migration_timestamps: [
226+
type: :utc_datetime,
227+
inserted_at: :created_at,
228+
updated_at: :changed_at
229+
]
224230
225231
* `:migration_lock` - By default, Ecto will lock the migration table. This allows
226232
multiple nodes to attempt to run migrations at the same time but only one will
@@ -997,6 +1003,9 @@ defmodule Ecto.Migration do
9971003
Those columns are of `:naive_datetime` type and by default cannot be null. A
9981004
list of `opts` can be given to customize the generated fields.
9991005
1006+
Following options will override the repo configuration specified by
1007+
`:migration_timestamps` option.
1008+
10001009
## Options
10011010
10021011
* `:inserted_at` - the name of the column for storing insertion times.

0 commit comments

Comments
 (0)