This project is archived and is in readonly mode.
Parameter "-f" for "rails generate model" does not overwrite migration files
Reported by Mike Bethany | September 2nd, 2010 @ 12:25 AM
Synopsis:
The rails g model ... -f option states, "-f, [--force] # Overwrite
files that already exist" but migration file is not overwritten if
it already exists for the model and results in an error
message.
Using:
Rails 3.0.0
ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin10.4.0], MBARI
0x6770, Ruby Enterprise Edition 2010.02
Following these steps:
$ rails new demo
$ cd demo
$ rails g model testmodel
$ rails g model testmodel testfield:string -f
Receive error:
Another migration is already named create_testmodels:
/Users//development/demo/db/migrate/20100901231151_create_testmodels.rb
Work around:
Delete migration file before regenerating model.
Comments and changes to this ticket
-
David Trasbo September 2nd, 2010 @ 03:29 PM
- Assigned user set to José Valim
Here's a patch that makes
rails g model
andrails g migration
remove the colliding migration file if you pass--force
to it. -
Repository September 18th, 2010 @ 08:22 PM
- State changed from new to committed
(from [e8082246529737b6cf0d5cc3c948e54896aa1329]) Remove existing migration when using 'rails generate model' with --force [#5526 state:committed]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/e8082246529737b6cf0d5cc3c948e5...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 5526 Parameter "-f" for "rails generate model" does not overwrite migration files (from [e8082246529737b6cf0d5cc3c948e54896aa1329]) Remove ...