This patch provides bigint support for migrations. The :biginteger type can be used for column definitions and the :use_big_id option can be set to use a bigint as the primary key in a table.
Here is an example migration.
class GameDslMigration < ActiveRecord::Migration
def self.up
create_table :random_numbers, :use_big_id => true, :force => true do |t|
t.column "randnum", :biginteger, :null=> false
end
end
def self.down
drop_table :random_numbers
end
end
NOTES
1. I struggled with the name for the type. I started with :bignum, but thought that might be misleading because it isn't unlimited in size like the ruby type. :bigint seemed to tied to MySQL, other databases might support it. So I settled for :biginteger
1. SQLite and SQLite3 engines are supported; they simply treat :biginteger the same as :integer. If you check the type of a :biginteger column it will be reported as :integer. SQLite doesn't distinguish.
1. I think that all that needs to be done to support other engines is to define :biginteger and :big_primary_key in the adapter.
1. I'm pretty sure the tests won't pass for the other engines. I assumed that they would get implemented and didn't put a lot of adapter type checks in the tests. That should make it easier to implement the other adapters. I can go back and add the checks if necessary.