migrations: t.references doesn't allow index name to be specified
ruby, ruby-on-rails
Solution
According to Rails code for `references`, you can do so, providing `index` a `Hash` with options, the one you need called `:name`, so:
t.references :my_field, index: { name: 'my_index_name' }
Problem
I have the following in a migration: ``` create_table :model_with_a_long_name do |t| t.references :other_model_with_an_equally_long_name, index: true end ``` That produces an index with too long of a name for Postgres. Is there a way to manually specify the index name (without adding the integer column and the index separately)? Something like the following: ``` create_table :model_with_a_long_name do |t| t.references :other_model_with_an_equally_long_name, index: true, index_name: 'model_and_other' end ``` ?