Hi,
i have column name phone with integer datatype but when i enter phone
number it throws an error
"1325565488 is out of range for ActiveRecord::Type::Integer with limit
4"
i have changed limit to 8 in migration file but still it didn't work.
Hi,
i have column name phone with integer datatype but when i enter phone
number it throws an error
"1325565488 is out of range for ActiveRecord::Type::Integer with limit
4"
goto your db folder and in the migration change the phone number field
data type from integer to string. and thats all. but u will will to do
rake db:migrate
after that.
Agreed. If you change an old migration, and run `rake db:migrate` *NOTHING*
will happen, because that migration is already saved in the database table
'schema_migrations'. You either need to create a new migration, or you have
to drop the data base and re-run all the migrations.
I once tried to circumvent this in a panic situation by deleting the schema
migration record and re-running the migration, but it was such a crazy
thing to try, I gave up.
My advice is to do just as Colin suggested, and use a *new* migration to
change the table.
> Ramu Goud wrote in post #1182441:
>> Hi,
>> i have column name phone with integer datatype but when i enter phone
>> number it throws an error
>> "1325565488 is out of range for ActiveRecord::Type::Integer with limit
>> 4"
>
> goto your db folder and in the migration change the phone number field
> data type from integer to string. and thats all. but u will will to do
> rake db:migrate
> after that.
It is best to add a new migration to do this.
Colin
((this is what I tried to send))
Agreed. If you change an old migration, and run `rake db:migrate` *NOTHING* will happen, because that migration is already saved in the database table 'schema_migrations'. You either need to create a new migration, or you have to drop the data base and re-run all the migrations.
I once tried to circumvent this in a panic situation by deleting the schema migration record and re-running the migration, but it was such a crazy thing to try, I gave up.
My advice is to do just as Colin suggested, and use a *new* migration to change the table.
It's helpful to think of migrations as "version control for your database". They capture the steps along the way to where you are now (the schema.rb is the current state, or HEAD, of your migrations).