Rails: How to resolve db schema load bigint issue

If you have recently migrated your rails application and tried the rails db:setup or rails db:schema:load commands, you might have noticed an error like this:

Column aaa_id on table bbb does not match column id on aaaa, which has type bigint(20). To resolve this issue, change the type of the aaa_id column on bbb to be :bigint. (For example t.bigint :aaa_id).

I will recommend the use of bigint if you are creating a new rails application, in the case of existing application, please add the following code into application.rb file to avoid this issue.

In the Schema.rb file, make sure that you mention id: :integer in create table block

Before

After

Written by

One thought on “Rails: How to resolve db schema load bigint issue

Leave a Reply

Your email address will not be published. Required fields are marked *