# Rake db:schema:load from capistrano

**URL:** <https://www.ruby-forum.com/t/rake-dbload-from-capistrano/138250>\
**Category:** Deployment\
**Created:** [May 21, 2008, 11:23am UTC](https://www.ruby-forum.com/t/rake-dbload-from-capistrano/138250 "2008-05-21T11:23:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![temesta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e9bcb4/32.png) [@temesta](https://www.ruby-forum.com/u/temesta)\
**Post date:** [May 21, 2008, 11:23am UTC](https://www.ruby-forum.com/t/rake-dbload-from-capistrano/138250/1 "2008-05-21T11:23:54Z")

</div>

Hi,

I’m not sure why this isn’t working form me. In my deploy script  
I have the following task:

desc “cold deploy”  
task :cold do  
update  
mongrel.cluster.configure  
run “cd #{release\_path}”  
sudo “rake db:schema:load”  
start  
mongrel.cluster.status  
end

Unfortunately I get this nasty error:

- executing “rake db:schema:load”  
servers: [“alvaket.be”]  
[alvaket.be] executing command  
\*\* [out :: alvaket.be] rake aborted!  
\*\* [out :: alvaket.be]  
\*\* [out :: alvaket.be] No Rakefile found (looking for: rakefile,  
Rakefile, rakefile.rb, Rakefile.rb)

BUT, it works when I deploy without db:schema:load and then run  
db:schema:load manually on the server … Strange because Rakefile is  
uploaded during update

---

<div class="post-metadata">

**Author:** ![temesta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e9bcb4/32.png) [@temesta](https://www.ruby-forum.com/u/temesta)\
**Post date:** [May 29, 2008, 11:52am UTC](https://www.ruby-forum.com/t/rake-dbload-from-capistrano/138250/2 "2008-05-29T11:52:50Z")

</div>

as you do the cd in one call and the rake in a second call, the  
working dir for the second call is not correct.

Try:

run “cd #{release\_path} && sudo rake db:schema:load”

That should do what you expected.

On 21 Mai, 11:23, Maarten P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![temesta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e9bcb4/32.png) [@temesta](https://www.ruby-forum.com/u/temesta)\
**Post date:** [June 8, 2008, 7:14pm UTC](https://www.ruby-forum.com/t/rake-dbload-from-capistrano/138250/3 "2008-06-08T19:14:01Z")

</div>

Matthias wrote:

> as you do the cd in one call and the rake in a second call, the  
> working dir for the second call is not correct.
> 
> Try:
> 
> run “cd #{release\_path} && sudo rake db:schema:load”
> 
> That should do what you expected.
> 
> On 21 Mai, 11:23, Maarten P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

Thank you very much. It seems to work nicely!
