需求: 项目中某个字段原来设置的数据类型是 integer, 后来业务变更,需要存储的 id 长度很长,integer 放不下,数据库用的是 pg,查了一下 pg 支持 bigint , 支持长度为:-9223372036854775808 到 9223372036854775807
测试: rails g scaffold user name:string age:bigint
执行 migrate 的时候:
StandardError: An error has occurred, this and all later migrations canceled:
undefined method `bigint' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::TableDefinition:0x000000041ac4e0>/home/chenc/gcj_project/gcj_project/test_bigint/db/migrate/20140603092600_create_users.rb:5:in `block in change'