I had a column called \"prize\":
create_table :contests do |t|
t.text :prize
I recently realized that this will always be an integer and
First you should use the same DB in both environments to prevent this kind of surprises.
To run raw sql in migrations see this example http://guides.rubyonrails.org/migrations.html#using-the-up-down-methods
I think you'll have to do it by hand:
def up
connection.execute(%q{
alter table contests
alter column prize type integer using cast(prize as integer),
alter column price set default 200
})
end
If you want to run the same migration in both MySQL and PostgreSQL then:
def up
case ActiveRecord::Base.connection
when ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
connection.execute(%q{
alter table contests
alter column prize type integer using cast(prize as integer),
alter column price set default 200
})
when ActiveRecord::ConnectionAdapters::MySQLAdapter
# MySQL version...
end
end
Once you get around this problem, your next task will be to switch your development environment over to PostgreSQL so that you can start fixing all the other little problems (such as GROUP BY issues, case sensitive LIKE, column truncation behavior, ...) that you'll run into.