But on my local machine I edited one of the earlier migrations. I’ve
tried “cap deploy_with_migrations”, but it looks like it didn’t rebuild
the database.
How can I do the equivalent of this using Capistrano?
“rake db:migrate VERSION=0”
“rake db:migrate”
To force a migration to ‘x’ from wherever you are now.
You can try to do this with:
cap invoke COMMAND=“env RAILS_ENV=production rake db:migrate
VERSION=0” ROLES=app
It might be that you want the ROLES=db, but if you have everything on
a single host, that doesn’t matter anyway (you could replace ROLES=db
with HOST=yourhost.com if you want/need to be specific).
I think this works with both cap1.x and cap2.0, but I’m just typing,
not testing, so your results may vary. (Since you want to wipe the
database, I feel fairly safe suggesting that you try it.)
I am talking crap; the remote deployment under current does contain a
Rakefile and I just logged in and ran a rake task manually to migrate my
database.
But for me; the cap invoke task does not work and just says that no rake
file can be found.
I am using Capistrano 2.1.0 and my general deployments work fine.
When you issue the cap command that will presumably try to tun the rake
command on the remote server, it just tells me that it can’t find a
rake file.
The remote code has not been capified and so has no rake file, so unless
you want to check the rake file in to your source code I don’t see this
one working.
Please shout if talking crap though.
Cheers
cap invoke COMMAND=“env RAILS_ENV=production rake db:migrate
VERSION=0” ROLES=app
It might be that you want the ROLES=db, but if you have everything on
a single host, that doesn’t matter anyway (you could replace ROLES=db
with HOST=yourhost.com if you want/need to be specific).
I think this works with both cap1.x and cap2.0, but I’m just typing,
not testing, so your results may vary. (Since you want to wipe the
database, I feel fairly safe suggesting that you try it.)