Skip to content

Commit add6b17

Browse files
committed
Add documentation for nulls_not_distinct
Adds API documentation for the nulls_not_distinct option for ActiveRecord::ConnectionAdapters::SchemaStatements.add_index. Resolves issue rails#52852.
1 parent fd975a8 commit add6b17

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)