I’ve read through a bunch of posts and googled hard but can’t find a set of things to check to solve the following error when I do a:
heroku db:push
I’ve read this answer: Rails migrations over an existing database
But it doesn’t quire solve the problem I’m having. I’m currently getting the following error:
messages: 100% |==========================================| Time: 00:00:00
numbers: 0% | | ETA: --:--:--
Saving session to push_201109120849.dat..
!!! Caught Server Exception
HTTP CODE: 500
Taps Server Error: PGError: ERROR: integer out of range
And my Numbers migration looks like this:
class CreateNumbers < ActiveRecord::Migration
def self.up
create_table :numbers do |t|
t.integer :inbound_num
t.boolean :assigned
t.timestamps
end
end
def self.down
drop_table :numbers
end
end
I am using the integer data type to save mobile phone numbers. I am not sure this is a good idea having read this: What datatype should be used for storing phone numbers in SQL Server 2005?
The thing is the data works great locally so I don’t think I’ve chosen a terrible data-type.
The numbers in the DB I’m pushing look like this:
447786201383
447786201387
447786201389
etc…
Thanks so much in advance!
In your migration, you’ve something like
But default for Postgresql used on heroku is 4 bytes
So you should change your ints for bigints.
To do that, use the
:limit. Example: