Rails - Change_column 迁移是否会影响现有约束
如果我有一个字段并且它已经进行了迁移以设置 :null =>; false
然后我进行另一次迁移以添加 :unique =>; true
- 我现在需要列出现有的 :null => false
也在新迁移中吗?
如果我没有在新迁移中列出它是否意味着它实际上被删除了?
If I have a field and it already has had a migration to set :null => false
and I then do another migration to add :unique => true
- do I now need to list the existing :null => false
also in the new migration?
If I do not list it in the new migration does that imply it actually gets removed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所有迁移更改都与当前数据库状态相关,您无需从一开始就列出所有现有更改。
确定的好方法就是简单地进行测试。格
all migration changes are relative to current database state, you don't need to list all existing changes from the beginning.
Good way to became sure is simply perform a test. gl