Rails 5.1 migrations generates BIGINT
(instead of Integer
) for tables' primary keys (changelog).
Is it possible to disable that somewhere in the config? If so, how to do disable it?
According to pull request, no this is not possible on config level.
But you can, in fact, force id
to be integer, like this:
create_table :users, id: :integer do
On the other hand, you must be aware that changes also affected references
behavior, so you should be careful with those:
t.references :orders, type: :integer
Seeing as this is too much repeated code, I suggest you write helpers for this, override default methods, or be very radical and fork your database adapter, changing this in it as you like. I'd go with the second option:
Migration[5.0]
and ActiveRecord::ConnectionAdapters::TableDefinition
create_table
, add_reference
, add_belongs_to
in first one, references
and belongs_to
in second one (belongs_to
ones should be just aliases of references
)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With