code_junkie

How can I define a BigInt primary key with Rails 2.1 and MySQL?

Nov 12th, 2011
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. require 'active_record/connection_adapters/mysql2_adapter'
  2. ActiveRecord::ConnectionAdapters::Mysql2Adapter::NATIVE_DATABASE_TYPES[:primary_key] =
  3. "BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY".freeze
  4.  
  5. t.column :product_id, 'BIGINT UNSIGNED'
Add Comment
Please, Sign In to add comment