# SwitchTower and multiple database.yml files - how do you dea

**URL:** <https://www.ruby-forum.com/t/switchtower-and-multiple-database-yml-files-how-do-you-dea/96853>\
**Category:** Rails\
**Created:** [January 24, 2006, 10:32pm UTC](https://www.ruby-forum.com/t/switchtower-and-multiple-database-yml-files-how-do-you-dea/96853 "2006-01-24T22:32:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![seanhussey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a88e57/32.png) [@seanhussey](https://www.ruby-forum.com/u/seanhussey)\
**Post date:** [January 24, 2006, 10:32pm UTC](https://www.ruby-forum.com/t/switchtower-and-multiple-database-yml-files-how-do-you-dea/96853/1 "2006-01-24T22:32:35Z")

</div>

Hi everyone,

What are other people doing with regards to database.yml being in  
version control? My dilema:

I set up my rails app in svn using these instructions:

[http://wiki.rubyonrails.com/rails/pages/HowtoUseRailsWithSubversion](http://wiki.rubyonrails.com/rails/pages/HowtoUseRailsWithSubversion)

The part to note is where I ignore database.yml, allowing different  
developers to keep their own database.yml without clobbering other  
developers’ files. Sounds good. We typically use local MySQL  
databases for local development and the production server uses a  
remote db server running PostGres.

I just started deploying with SwitchTower, however, so, at first  
checkout, there was no database.yml. That’s ok. I created it and all  
is well.

Except when I deploy the next version. No database.yml! Uh oh.

So, am I doing something fundamentally wrong in not version  
controlling database.yml? Should the production server only be  
concerned with the production database (remote postgres) and the local  
users be concerned with dev database (local mysql)? Should all  
developers learn to play nicely with one database.yml file and set the  
environments up accordingly?

I’m thinking this is the way, but it’s different than how I started  
based on the above URL. What are other people doing?

Thanks!

Sean

---

<div class="post-metadata">

**Author:** ![seanhussey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a88e57/32.png) [@seanhussey](https://www.ruby-forum.com/u/seanhussey)\
**Post date:** [January 24, 2006, 10:53pm UTC](https://www.ruby-forum.com/t/switchtower-and-multiple-database-yml-files-how-do-you-dea/96853/2 "2006-01-24T22:53:45Z")

</div>

I know others have solved this problem by using an after\_update\_code  
hook that renames the real database.yml file:

task :after\_update\_code do  
run “mv #{release\_path}/config/database.yml.real #{release\_path}/  
config/database.yml”  
end

Then, you version control the config/database.yml.real file (or not,  
depending on how paranoid you are about your production DB password).

- Jamis

---

<div class="post-metadata">

**Author:** ![seanhussey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a88e57/32.png) [@seanhussey](https://www.ruby-forum.com/u/seanhussey)\
**Post date:** [January 24, 2006, 10:59pm UTC](https://www.ruby-forum.com/t/switchtower-and-multiple-database-yml-files-how-do-you-dea/96853/3 "2006-01-24T22:59:50Z")

</div>

Dang. So damn easy, I can see why I didn’t think of it myself.

Thank you!

Sean
