views:

231

answers:

3

How would you maintain separate production anddeveloper databases when working on one machine, which you can toggle transparently? I've seen some close subjects but none of them seem to match.

A: 

I typically see this done one of two ways.

  1. Use two configuration files, and simply rename them as needed to enable each environment

  2. Use two copies of the application/website on the machine, one that is production one that is dev.

I personally prefer the second option, as I find that the first one makes it WAY too easy to accidentally be on the production database.

Mitchel Sellers
+2  A: 

Call one database prod and one dev. use a different set of username/password pair for production and development.
You can toggle the connection string & change the database, username and password.

Nick Kavadias
A: 

Ideally the production environment shouldn't be on the same host as the development environment (so any accidentally long running or intensive queries don't take down production).

One approach I've used in the past where I needed a QA environment and a development environment side-by-side, was to use different instances of SQL Server, which had the added advantage that inter-database queries were relatively "safe", and didn't need changing between environments; Then just have different config files as appropriate.

Rowland Shaw