In Rails/ActiveRecord 3, how do I change the default primary key type for MySQL?
- by jfarmer
In Rails 3, how do you change the default primary key type to, say, BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY
In my case I'm only interested in MySQL.
For Rails 2, you can see the answer to "How do I use long IDs in Rails?"1
In Rails 3, however, this will throw an error. I'm not sure if that's because the class is no long used, or if the code needs to go in the same place. You can see in active_record/connection_adapters/mysql_adapter.rb that the NATIVE_DATABASE_TYPES constant is still defined.
What's the correct way to achieve the same effect in Rails 3?