Skip to content

Commit 2236b6f

Browse files
committed
Improve index option docs
1 parent 2d97915 commit 2236b6f

1 file changed

Lines changed: 16 additions & 12 deletions

File tree

lib/ecto/migration.ex

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -771,25 +771,29 @@ defmodule Ecto.Migration do
771771
## Options
772772
773773
* `:name` - the name of the index. Defaults to "#{table}_#{column}_index".
774-
* `:unique` - indicates whether the index should be unique. Defaults to
775-
`false`.
776-
* `:concurrently` - indicates whether the index should be created/dropped
777-
concurrently.
778-
* `:using` - configures the index type.
779774
* `:prefix` - specify an optional prefix for the index.
780-
* `:where` - specify conditions for a partial index.
781-
* `:include` - specify fields for a covering index. This is not supported
782-
by all databases. For more information on PostgreSQL support, please
783-
[read the official docs](https://www.postgresql.org/docs/current/indexes-index-only-scans.html).
775+
* `:unique` - indicates whether the index should be unique. Defaults to `false`.
776+
* `:comment` - adds a comment to the index.
777+
* `:using` - configures the index type.
778+
779+
Some options are supported only by some databases:
780+
781+
* `:concurrently` - indicates whether the index should be created/dropped
782+
concurrently in MSSQL and PostgreSQL.
783+
* `:include` - specify fields for a covering index,
784+
[supported by PostgreSQL only](https://www.postgresql.org/docs/current/indexes-index-only-scans.html).
784785
* `:nulls_distinct` - specify whether null values should be considered
785786
distinct for a unique index. Defaults to `nil`, which will not add the
786787
parameter to the generated SQL and thus use the database default.
787788
This option is currently only supported by PostgreSQL 15+.
788789
For MySQL, it is always false. For MSSQL, it is always true.
789790
See the dedicated section on this option for more information.
790-
* `:only` - Indicates not to recurse creating indexes on partitions, if the table is partitioned.
791-
This option is currently only supported by PostgreSQL 11+. Defaults to `false`.
792-
* `:comment` - adds a comment to the index.
791+
* `:only` - indicates to not recurse creating indexes on partitions.
792+
[supported by PostgreSQL only](https://www.postgresql.org/docs/current/ddl-partitioning.html#DDL-PARTITIONING-DECLARATIVE-MAINTENANCE).
793+
* `:options` - configures index options (WITH clause) for both PostgreSQL
794+
and MSSQL
795+
* `:where` - specify conditions for a partial index (PostgreSQL) /
796+
filtered index (MSSQL).
793797
794798
## Adding/dropping indexes concurrently
795799

0 commit comments

Comments
 (0)