本文介绍了什么是:force =>在模式文件中的真实意义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果你看看db / schema.rb,你会看到如下:
create_tableusers > true do | t |
:force => :
基本上,这有助于确保数据库的完整性。如果您手动处理迁移,那么确保您从一个干净的平面创建新表,而不是冒着从一次性创建的表中冒出命名冲突的风险。
If you look in db/schema.rb you will see something like:
create_table "users", :force => true do |t|
What does the :force => true
mean?
解决方案
From the Rails docs:
Basically, this helps ensure database integrity. If you're manually tooling around with your migrations, it's helpful to ensure that you're creating new tables from a clean slate, rather than risking naming conflicts that stem from tables that have been created on a one-off basis.
这篇关于什么是:force =>在模式文件中的真实意义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!