Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does :force => true mean in the schema file

Tags:

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?

like image 255
Tom Prats Avatar asked Sep 09 '13 18:09

Tom Prats


1 Answers

From the Rails docs:

:force

Set to true to drop the table before creating it. Defaults to false.

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.

like image 191
zeantsoi Avatar answered Sep 29 '22 11:09

zeantsoi