method
index
v7.0.0 -
Show latest stable
- Class:
ActiveRecord::ConnectionAdapters::ColumnMethods::Table
index(column_name, **options)public
Adds a new index to the table. column_name can be a single Symbol, or an Array of Symbols.
t.index(:name) t.index([:branch_id, :party_id], unique: true) t.index([:branch_id, :party_id], unique: true, name: 'by_branch_party')
See {connection.add_index}[rdoc-ref:SchemaStatements#add_index] for details of the options you can use.