I''ve deployed an application using Capistrano. 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" -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
wentwj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Oct-22 22:03 UTC
Re: HOW TO REBUILD DATABASE WITH CAPISTRANO
I''m not sure if Capistrano comes with a built in method to do this, If you can gain access to the production machine you can just run rake db:migrate VERSION=0 or rake db:migrate VERISON=0 RAILS_ENV=production to redump it. Otherwise you can always just access the database directly, drop the schema, and recreate it. On Oct 22, 2:59 pm, Joe Peck <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I''ve deployed an application using Capistrano. > > 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" > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Oct 22, 2007, at 6:03 PM, wentwj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> I''m not sure if Capistrano comes with a built in method to do this, > If you can gain access to the production machine you can just run > > rake db:migrate VERSION=0 > or > rake db:migrate VERISON=0 RAILS_ENV=production > > to redump it. > > Otherwise you can always just access the database directly, drop the > schema, and recreate it. > > On Oct 22, 2:59 pm, Joe Peck <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> I''ve deployed an application using Capistrano. >> >> 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" >> --Editing a migration doesn''t change the version number that the system thinks the schema is right now. In any case, you probably need to do this manually. If the target machine is some type of POSIX (unix, etc.), you can probably do: env RAILS_ENV=production rake db:migrate VERSION=x 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.) -Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org
Hey; 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.) > > -Rob > > Rob Biedenharn http://agileconsultingllc.com > Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Well, 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. Cheers, Paul -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---