We've moved discussions to Discord

Running rails db:migrate will change some primary key from bigint to integer?

Aska Konomi
When I run rails db:migrate in an existing project, the migration files are not changed, but the schema.rb will be updated, and some of the primary keys (mostly account related) will be changed from bigint to integer.

For example:
スクリーンショット 2022-02-22 14.41.33.png 107 KB


The migration files were not changed. I can't figure out why.

Will this have bad effects on a running database (postgres)?

Update:

If I run rake db:schema:load instead of migrate, I can get the ids created as bigint. If I run rake db:migrate afterwards, it won't update the schema.

But if I run the migration with an empty database, then the schema will be changed to use integer, and the table ids created are integer as well.

Does this the migration defaults for primary keys is changed somehow?
Brad Carson
This happened to me as well and am wondering if this is intentional or should be changed back to bigint. 
Notifications
You’re not receiving notifications from this thread.