有没有办法删除ID列在随后的Rails 3的ActiveRecord迁移? [英] Is there a way to remove the id column in a subsequent Rails 3 ActiveRecord migration?

查看:158
本文介绍了有没有办法删除ID列在随后的Rails 3的ActiveRecord迁移?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Rails 3中ActiveRecord的CREATE_TABLE是有可能包括选项:ID =>假的。例如

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

但有可能删除:id列上现有的表在随后的向上迁移?

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

推荐答案

您应该能够删除该列,就像任何其他的非id列:

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

remove_column :posts, :id

这篇关于有没有办法删除ID列在随后的Rails 3的ActiveRecord迁移?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆