Method: ActiveRecord::ConnectionAdapters::SchemaStatements#add_index_options
- Defined in:
- activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
#add_index_options(table_name, column_name, name: nil, if_not_exists: false, internal: false, **options) ⇒ Object
:nodoc:
1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb', line 1476 def (table_name, column_name, name: nil, if_not_exists: false, internal: false, **) # :nodoc: .assert_valid_keys(:unique, :length, :order, :opclass, :where, :type, :using, :comment, :algorithm, :include, :nulls_not_distinct) column_names = index_column_names(column_name) index_name = name&.to_s index_name ||= index_name(table_name, column_names) validate_index_length!(table_name, index_name, internal) index = IndexDefinition.new( table_name, index_name, [:unique], column_names, lengths: [:length] || {}, orders: [:order] || {}, opclasses: [:opclass] || {}, where: [:where], type: [:type], using: [:using], include: [:include], nulls_not_distinct: [:nulls_not_distinct], comment: [:comment] ) [index, index_algorithm([:algorithm]), if_not_exists] end |