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:
MB-A:sample_app sm$ 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:
MB-A:sample_app sm$ 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 to the DESTROY command:
MB-A:sample_app sm$ 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
responded by 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:
MB-A:sample_app sm$ 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 now that the migration.rb file has
been removed. If so - what are my options for fixing that situation?
Many thanks in advance…