2017-09-12 5 views
0

레일 5.1로 업그레이드 중이지만 인덱스 이름이 너무 길어서 마이그레이션이 실패합니다.Ruby on rails 5.1 업그레이드, 인덱스 이름을 지정할 수 없습니다.

오류 :

인덱스 이름이 자동으로 생성됩니다
ArgumentError: Index name 'index_mailboxer_notifications_on_notified_object_type_and_notified_object_id' on table 'mailboxer_notifications' is too long; the limit is 63 characters 

,하지만 난 name: 명령을 사용하여 이름을 할 수 있어야한다.

Migration.rb

add_index :mailboxer_notifications, [:notified_object_id, :notified_object_type], 
    name: 'index_mailboxer_notifications_on_notified_object_id_and_type' 

그러나 name: 명령을 무시지고있는 것 같다. 이것은 레일 5.1에서 변경 되었습니까? 색인 이름을 지정하는 다른 방법이 있습니까?

답변

0

색인 이름이 너무 길어서 이주가 실행되지 않으면 색인을 작성하지 않아야합니다.

notified_object_id, notified_object_type 컬럼이있는 경우 drop index를 시도하고 인덱스 이름으로 다시 마이그레이션을 실행하십시오.