Skip to content

Commit 5ff57a5

Browse files
authored
Merge pull request rails#53029 from jgsheppa/52852_nulls_not_distinct_documentation
Add documentation for `nulls_not_distinct` option to `add_index` [ci skip]
2 parents fd975a8 + add6b17 commit 5ff57a5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,16 @@ def rename_column(table_name, column_name, new_column_name)
855855
#
856856
# Note: only supported by PostgreSQL.
857857
#
858+
# ====== Creating an index where NULLs are treated equally
859+
#
860+
# add_index(:people, :last_name, nulls_not_distinct: true)
861+
#
862+
# generates:
863+
#
864+
# CREATE INDEX index_people_on_last_name ON people (last_name) NULLS NOT DISTINCT
865+
#
866+
# Note: only supported by PostgreSQL version 15.0.0 and greater.
867+
#
858868
# ====== Creating an index with a specific method
859869
#
860870
# add_index(:developers, :name, using: 'btree')

0 commit comments

Comments
 (0)