有没有办法删除ID列在随后的Rails 3的ActiveRecord迁移?

编程入门 行业动态 更新时间:2024-10-23 17:34:00
本文介绍了有没有办法删除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迁移?

本文发布于:2023-10-17 10:33:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1500659.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:没有办法   在随后   ActiveRecord   ID   Rails

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!