capistrano: deploying production and staging to same database

I have the production and staging site on two different server ips. But the database, another server ip, is the same database used by both production and staging. When i set up the capistrano deploy task for both the production and staging, should I keep the db role in deploy.rb like this:

deploy.rb

role :db,  "database_ip", :primary => true

production.rb
role :web, "production_ip"

role :app, "production_ip"

staging.rb

role :web, “staging_ip”

role :app, “staging_ip”

Or should I do it this way:

production.rb
role :web, "production_ip"

role :app, "production_ip"

role :db, “database_ip”, :primary => true


staging.rb
role :web, "production_ip"

role :app, "production_ip"

role :db, “database_ip”, :primary => true

I have the production and staging site on two different server ips. But the database, another server ip, is the same database used by both production and staging. When i set up the capistrano deploy task for both the production and staging, should I keep the db role in deploy.rb like this:

You could either. It might be easier to understand though if all the hosts for a given stage are in the same file.

However, the :db role doesn’t actually mean the database server itself - it means where should migrations be run from.

Fred