Deleted migration.rb file? Potential bug in rails?
I am not sure if this is a bug or if this actually removed a migration.rb file. I used generate to create the following migration:
$ rails generate migration add_delta_to_submissions
invoke active_record
create db/migrate/20111020175649_add_delta_to_submissions.rb
I then realized that I neglected to include any columns, so I used the UP ARROW in the console and overwrote generate with destroy:
$ rails destroy migration add_delta_to_submissions
invoke active_record
remove db/migrate/20111020175649_add_delta_to_submissions.rb
All good so far, now its time to run the migration with the column I need. Here is where the problem comes in - I used the UP ARROW again - but only once - and added my column info:
$ rails destroy migration add_delta_to_submissions delta:integer
invoke active_record
remove migration.rb
I realize I should probably NOT be using the UP ARROW for commands as volatile as GENERATE and DESTROY (lesson learned!), but that command came back stating it REMOVED the migration.rb file. I didn't even know there was a migration.rb file - especially not one that could be removed so easily.
For kicks, I decided to try and trick the command console by adding the letter x to the end of word migration - and received this message:
$ rails destroy migrationx add_delta_to_submissions delta:integer
Could not find generator migrationx.
So, I think there could be a bug with the rails destroy command. Once it realized there was no longer a add_delta_to_submissions.rb file, it just lopped that off and tacked on the .rb to the word migration (or any word after DESTROY). That seems a bit dangerous....
Regardless of that - I am curious to know if I have somehow compromised my RAILS environment (rails 3.1, ruby 1.8.7) now that the migration.rb file has been removed. If so - what are my options for fixing that situation?
Many thanks in advance...
It also happens when you type a non-existing migration name as parameter to destroy command
$rails migration destroy non-existing-migration-name
invoke active_record
remove migration.rb
But I think it is harmless.
Do you have git on your system? The same thing happened to be today and I ran:
git diff | grep migration
Nothing came out on my system. I searched for the file and still couldn't find any migration.rb on any of my Rails 3.1 projects. Probably can ignore it without any harm?
Same thing happened to me.
Looks like there is a migration.rb file within ActiveRecord, and though you can extend ActiveRecord::Base, I'm not sure you can actually access those files from somewhere within your rails project directory.
Looks like there is some precedent for deleting the migration file manually instead of through an automatic rails destroy command.
链接地址: http://www.djcxy.com/p/9772.html上一篇: .Net框架不兼容问题