If you get an error, that an index is too long:

ArgumentError: Index name 'index_cats_on_long_attribute_name' on table 'cats' is too long; the limit is 63 characters

You can specify a shorter index name instead:

add_index :cats, :long_attribute_name, name: 'my_index_name'
 
t.references :long_attribute_name, index: { name: :my_index_name }