Remote mig.rb file? Potential rail error?

I am not sure if this is an error or really deleted the 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 

Then I realized that I neglected to include any columns, so I used the UP ARROW in the console and overwrite the generate with destroy:

$ rails destroy migration add_delta_to_submissions

  invoke active_record remove db/migrate/20111020175649_add_delta_to_submissions.rb 

So far so good, now it's time to start the migration with the desired column. Here's the problem: I used 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 understand that I probably should NOT use UP ARROW for commands as volatile as GENERATE and DESTROY (lessons learned!), But this command returned with a message about deleting the migration.rb file. I did not even know that the mig.rb file is especially not one that can be easily deleted.

For the punches, I decided to try and trick the command console by adding the letter x to the end of the word wrap and receiving this message:

$ rails destroy migrationx add_delta_to_submissions delta:integer

  Could not find generator migrationx. 

So, I think there might be a bug with the rails destroy command. As soon as he realized that the add_delta_to_submissions.rb file was no longer there, he simply deleted it and attached it on .rb to the word wrap (or any word after DESTROY). It seems a little dangerous ....

Regardless, I’m interested to know how I somehow compromised the RAILS environment (rails 3.1, ruby ​​1.8.7) when the migration.rb file was deleted. If so, what are my options for rectifying this situation?

Thank you very much in advance...

+7
source share
3 answers

This also happens when you enter the name of a nonexistent carry as a parameter to destroy the command.

 $rails migration destroy non-existing-migration-name invoke active_record remove migration.rb 

But I think it is harmless.

+2
source

Do you have git on your system? The same thing happened today and I ran:

 git diff | grep migration 

Nothing came of my system. I searched the file and still could not find mig.rb in any of my Rails 3.1 projects. Probably can ignore it without any harm?

+1
source

The same thing happened to me.

There seems to be a migration.rb file in ActiveRecord, and although you can extend ActiveRecord :: Base , I'm not sure if you really can access these files anywhere in your rails project directory.

There seems to be some use case for manually deleting a migration file , rather than using the rails auto-delete command.

0
source

All Articles