谁能告诉我如何编辑以下迁移以更改 :phone
整数到字符串?
class CreateContactInfos < ActiveRecord::Migration
def change
create_table :contact_infos do |t|
t.integer :phone
t.string :facebook
t.references :user
t.timestamps
end
add_index :contact_infos, :user_id
end
end
提前致谢!
最佳答案
我猜你已经迁移了你展示的那个,所以创建另一个你放置的:
change_column :contact_infos, :phone, :string
关于ruby-on-rails - 迁移 : change column from integer to string,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6834175/