Is there a way to remove the id column in a subsequent Rails 3 ActiveRecord migration?

早过忘川 提交于 2019-12-23 17:00:41

问题


In Rails 3 ActiveRecord create_table is it possible to include the option :id => false. For example

create_table :posts, :id => false do |t|
...
end

but is it possible to remove the :id column on an existing table in a subsequent up migration?


回答1:


You should be able to remove the column just like any other non-id column:

remove_column :posts, :id


来源:https://stackoverflow.com/questions/8394253/is-there-a-way-to-remove-the-id-column-in-a-subsequent-rails-3-activerecord-migr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!