Skip to content

Commit

Permalink
Further clarification to custom expressions in index (#618)
Browse files Browse the repository at this point in the history
  • Loading branch information
emadshaaban92 authored Jun 19, 2024
1 parent 0c5581d commit a20f2d3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/ecto/migration.ex
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,11 @@ defmodule Ecto.Migration do
# Create a tsvector GIN index on PostgreSQL
create index("products", ["(to_tsvector('english', name))"],
name: :products_name_vector, using: "GIN")
If the expression is a column name, it will not be quoted. This may cause issues
when the column is named after a reserved word. Consider using an atom instead.
For example, the name `offset` is reserved in many databases so the following
could produce an error: `create index("products", ["offset"])`.
"""
def index(table, columns, opts \\ [])

Expand Down

0 comments on commit a20f2d3

Please sign in to comment.