So I've been successfully creating join tables by using the name
parameter when adding an index, but I'm not sure why this isn't working when I'm trying to do create a new migration:
class CreateVMailCampaignScheduleHours < ActiveRecord::Migration[5.1]
def change
create_table :v_mail_campaign_schedule_hours do |t|
t.belongs_to :v_mail_campaign_schedule, foreign_key: true
t.string :day
t.time :start_hours
t.time :stop_hours
t.timestamps
end
add_index [:v_mail_campaign_schedule_hours, :v_mail_campaign_schedule_id], name: :v_mail_campaign_schedule_id
end
end
The error I get is:
ArgumentError: Index name 'index_v_mail_campaign_schedule_hours_on_v_mail_campaign_schedule_id' on table 'v_mail_campaign_schedule_hours' is too long; the limit is 64 characters
Any suggestions? I thought my add_index
would do the trick, but apparently not.