我尝试在heroku上将表格列从字符串更改为整数,运行了迁移:
这是我的迁移文件:
class ChangePriceTypeInItems < ActiveRecord::Migration
def change
change_column :items, :price, :integer
end
end
这是我的错误: 我该怎么做?
ActiveRecord::StatementInvalid: PG::Error: ERROR: column "price" cannot be cast automatically to type integer
HINT: You might need to specify "USING price::integer".
: ALTER TABLE "items" ALTER COLUMN "price" TYPE integer
:integer
。 - user896237