method

index

Importance_1
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: 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.

Show source
Register or log in to add new notes.