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:
1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb', line 1449 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 |