How can I change the (default) type for ActiveRecord\'s IDs? int is not long enough, I would prefer long. I was surprised that there is no :long for the migrations - does on
I wrote a gem called activerecord-native_db_types_override that lets you alter the datatypes that will be used in your migrations.
In your Gemfile, add:
gem 'activerecord-native_db_types_override'
then in config/environment.rb, to use long ids in postgres, add:
NativeDbTypesOverride.configure({
postgres: {
primary_key: { name: "bigserial primary key"}
}
})
See its README for up-to-date info.