From the command line, I can run
rake db:migrate:up VERSION=20120123160700
This will migrate up to that specific version.
I want to be able to migrate up (but not beyond a specific version) from a rake task, preferably using db:migrate:up.
I’ve tried the following and put the error messages below:
Rake::Task['db:migrate:up VERSION=20120123160700'].invoke
Don’t know how to build task ‘db:migrate:up VERSION=20111208105833’
Rake::Task['db:migrate:up'].invoke('VERSION=20120123160700')
VERSION is required
Rake.application.invoke_task("db:migrate:up[VERSION=20120123160700]"
VERSION is required
Rake.application.invoke_task("db:migrate:up[VERSION=20120123160700]"
Don’t know how to build task ‘db:migrate:up VERSION=20111208105833’
How can I make this work?
It’s probably not the better solution but it should work. You can do this :
You can see the source here : https://github.com/rails/rails/blob/621df2a1ec01b77f7b052b3571f3c696f0443fea/activerecord/lib/active_record/railties/databases.rake at line 163.