Rails Migration: Bigint on PostgreSQL seems to be failing?

Lonecat picture Lonecat · Aug 15, 2011 · Viewed 13.1k times · Source

Trying to create a table with a bigint column creates a standard integer column instead. What could be going wrong? I don't know where to start looking.

I'm using this in the migration:

create_table :table_name do |t|
  t.integer :really_big_int, limit: 8
end

I'm using Ruby 1.9.2, PostgreSQL 9.0.3 and Rails 3.0.9. I've dropped the database and ran the migrations several times and it still doesn't create the bigint column.

Answer

Chris Barretto picture Chris Barretto · May 23, 2012

For some reason the create table doesn't like bigint. You can, however do it with add_columm using the bigint data type:

add_column :table_name, :really_big_int, :bigint

Then you don't need that limit stuff.