You can pass index options instead of true. For example: ``` t.references :vancancy, index: {name: :my_great_name} ``` Allen Madsen http://www.allenmadsen.com
On Fri, Jun 12, 2015 at 11:12 AM, Egor Vorobiev <e.vorob...@datarockets.com> wrote: > Hi, Folks! > > I wrote this. > ``` > class AddPremiumStatusTransactionsToVacancy < ActiveRecord::Migration > def change > create_table :jobs_data_vacancy_premium_status_transactions do |t| > t.integer :status, default: 0, null: false > t.references :vacancy, index: true > t.datetime :turn_on_premium_at > t.datetime :turn_off_premium_at > > t.timestamps null: false > end > end > ``` > > And after that I had an error > ``` > Index name > 'index_jobs_data_vacancy_premium_status_transactions_on_vacancy_id' on table > 'jobs_data_vacancy_premium_status_transactions' is too long; the limit is 63 > ``` > > Ok, I fixed it in this way > > ``` > class AddPremiumStatusTransactionsToVacancy < ActiveRecord::Migration > def change > create_table :jobs_data_vacancy_premium_status_transactions do |t| > t.integer :status, default: 0, null: false > t.references :vacancy > t.datetime :turn_on_premium_at > t.datetime :turn_off_premium_at > > t.timestamps null: false > end > > add_index :jobs_data_vacancy_premium_status_transactions, [:vacancy_id], > name: :index_premium_status_transactions_on_vacancy_id > end > end > ``` > > But I do not like this stuff. It will be great if i can write something like > ``` > t.references :vancancy, index: true, index_name: :my_great_name > ``` > > What do you think, about it? > > I can make a PR for your, if it's needed) > Thnx) > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-core+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-core@googlegroups.com. > Visit this group at http://groups.google.com/group/rubyonrails-core. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.