author avatar

sujay

Fri Jan 06 2023

Postgres index names are limited to maximum length of 63 characters.
If index name is longer than 63 characters while running rails migration it throws error


Index name 'index_external_reservation_airport_transfers_on_external_reservation_id' on table 'external_reservation_airport_transfers' is too long; the limit is 63 characters


Fix is to explicitly specify the index name


t.references :external_reservation, null: false, foreign_key: true, index: {:name => 'idx_external_reservation_airport_transfers_external_reservation'}