I took another look at your code and you are in fact using current_path in 
several tasks. 

There's almost never any good reason to directly use the symlink (which is the 
only place current_path is used in cap), it will only cause you pain. 

As I mentioned before use latest_release instead. This is a magic value that 
gets changed when you are deploying. If you are doing a deploy it points to the 
newest release that is to become the target of the symlink. If you are not 
deploying but running some maint task it will point to the same release dir 
that your symlink points to. 

On Jan 5, 2012, at 10:00 AM, Devin McCabe <[email protected]> wrote:

> When I deploy an update that has new migrations, I would like to run
> "cap deploy:migrations", which I believe is just a normal deploy plus
> a "rake db:migrate" in the new release's directory.
> 
> However, when I run that command, capistrano runs "rake db:migrate" in
> the "current" folder BEFORE the symlink is updated.
> 
> Here's the full gist of my "cap deploy:migrations": 
> https://gist.github.com/1566372
> 
> The relevant part is here:
> * 11:46:35 == Currently executing `deploy:migrate'
> * executing "cd /home/deploy/staging.example.com/current; bundle exec
> rake db:migrate RAILS_ENV=staging"
>  servers: ["staging.example.com"]
>  [staging.example.com] executing command
>  command finished in 38096ms
> * 11:47:13 == Currently executing `deploy:symlink'
> * executing "rm -f /home/deploy/staging.example.com/current && ln -s /
> home/deploy/staging.example.com/releases/20120105174430 /home/deploy/
> staging.example.com/current"
>  servers: ["staging.example.com"]
>  [staging.example.com] executing command
>  command finished in 232ms
>  triggering after callbacks for `deploy:symlink'
> 
> Shouldn't the migrations run in "current" AFTER the symlink? Or,
> shouldn't they run in the non-symlinked directory containing the new
> code? I have to run "cap deploy:migrate" manually after every deploy.
> 
> Here's my deploy script: https://gist.github.com/1566380
> 
> -- 
> * You received this message because you are subscribed to the Google Groups 
> "Capistrano" group.
> * To post to this group, send email to [email protected]
> * To unsubscribe from this group, send email to 
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/capistrano?hl=en

-- 
* You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
* To post to this group, send email to [email protected]
* To unsubscribe from this group, send email to 
[email protected] For more options, visit this group at 
http://groups.google.com/group/capistrano?hl=en

Reply via email to