@@ -274,6 +274,20 @@ defmodule Ecto.Migration do
274274
275275 config :app, App.Repo, migration_default_prefix: "my_prefix"
276276
277+ ## Collations
278+
279+ For columns with a text type, the collation can be set on the column with the
280+ option `:collation`. This can be useful when relying on ASCII sorting of
281+ characters when using a fractional index for example. All supported collations
282+ are not known by `ecto_sql` and specifying an incorrect collation might cause
283+ a migration to fail.
284+
285+ def change do
286+ create table(:collate) do
287+ add :string, :string, collation: "POSIX"
288+ end
289+ end
290+
277291 ## Comments
278292
279293 Migrations where you create or alter a table support specifying table
@@ -1166,6 +1180,7 @@ defmodule Ecto.Migration do
11661180 specified.
11671181 * `:scale` - the scale of a numeric type. Defaults to `0`.
11681182 * `:comment` - adds a comment to the added column.
1183+ * `:collation` - the collation of the text type.
11691184 * `:after` - positions field after the specified one. Only supported on MySQL,
11701185 it is ignored by other databases.
11711186 * `:generated` - a string representing the expression for a generated column. See
@@ -1345,6 +1360,7 @@ defmodule Ecto.Migration do
13451360 specified.
13461361 * `:scale` - the scale of a numeric type. Defaults to `0`.
13471362 * `:comment` - adds a comment to the modified column.
1363+ * `:collation` - the collation of the text type.
13481364 """
13491365 def modify ( column , type , opts \\ [ ] ) when is_atom ( column ) and is_list ( opts ) do
13501366 validate_precision_opts! ( opts , column )
0 commit comments