I am hoping rails.vim has some migration support.
I'm looking for something like: generate migration and jump to that file, and then a way to fire the migration.
Does this exist or am I dreaming? :)
You definitely can!
As mentioned, you can run the following to generate a migration:
:Rgenerate migration migration_name ...
Then this will switch to the latest migration:
:Rmigration
And then finally:
:Rake db:migrate
will actually migrate it for you.
Also I shouldn't forget to add that running
:Rinvert
in a migration file, will try to create the down portion of your migration (or visa versa).
With regard to running a migration:
When in migration file, e.g. 123456789_my_migration.rb:
:Rake will call rake db:migrate VERSION=123456789.
Note the . preceeding Rake in the following (this sends the line number to the command):
:.Rake on line 1, or inside the down method, will callrake db:migrate:down VERSION=123456789.
:.Rake on the last line, or inside the up method, will callrake db:migrate:up VERSION=123456789.
:.Rake anywhere else in the file will callrake db:migrate:down db:migrate:up VERSION=123456789.
I don't know of any documentation for this, I figured it out from looking at the appropriate part of rails.vim.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With