# Development, test and production - what for?

**URL:** <https://www.ruby-forum.com/t/development-test-and-production-what-for/65908>\
**Category:** Rails\
**Created:** [August 22, 2006, 10:46am UTC](https://www.ruby-forum.com/t/development-test-and-production-what-for/65908 "2006-08-22T10:46:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [August 22, 2006, 10:46am UTC](https://www.ruby-forum.com/t/development-test-and-production-what-for/65908/1 "2006-08-22T10:46:57Z")

</div>

Could some one explain why there is three different possible databases  
â??Â development, test and production? What’s the difference? How do you  
switch between them?

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [August 22, 2006, 11:13am UTC](https://www.ruby-forum.com/t/development-test-and-production-what-for/65908/2 "2006-08-22T11:13:31Z")

</div>

Hi Pal,

you are switching between them by using a different environment by  
stating  
the environment you want to use in environment.rb or by telling your  
application server to do so (for example the mongrel by mongrel\_rails  
start  
-e production.

The environment is what is the ‘headline’ above the configurations. A  
database-config comes with three predefined environments ‘development’,  
‘test’ and ‘production’ but you might configure some others for  
yourself.

The test environment is special because integration tests with fixtures  
which represent test data will be performed on a special test database.  
The  
advantage should be obvious. On the development database you should  
perform  
your development. This might be an physically different machine from  
your  
production database or at least decoupled as another database on the  
same  
machine. This way you could release stable versions to production and go  
online with it and destroy nothing on your production data while you are  
evolving on the development db.

Said shortly: As in many cases rails forces you to do the right thing.

Cheers,  
Jan

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [August 22, 2006, 12:20pm UTC](https://www.ruby-forum.com/t/development-test-and-production-what-for/65908/3 "2006-08-22T12:20:18Z")

</div>

Jan P. wrote:

Well explained. Thank you (and Tom). The database names says it all, I  
know. 🙂

Perhaps I should have asked how they are “managed”. What happens when  
using the rake to create the db? Will that add or change in them all? (I  
could also try this so you don’t have to answer, if you don’t feel like  
it)

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [August 22, 2006, 11:29am UTC](https://www.ruby-forum.com/t/development-test-and-production-what-for/65908/4 "2006-08-22T11:29:34Z")

</div>

On Aug 22, 2006, at 1:46 AM, Pål Bergström wrote:

> Could some one explain why there is three different possible databases  
> ? development, test and production? What’s the difference? How do you  
> switch between them?

Development is for development.

Test is for testing.

Production is for… 🙂

They are switched on via ENV[‘RAILS\_ENV’]

Also switched on are the config/environments/\* files.

You can have more environments if you choose.

Development and Testing are related in that when running tests, the  
development DB structure is moved into testing so that tests get run  
against the current development DB structure.

All of this structure is put in place to allow you to pre-define this  
information and not have to change code when it’s used in different  
environments.

–  
– Tom M.

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [August 22, 2006, 5:06pm UTC](https://www.ruby-forum.com/t/development-test-and-production-what-for/65908/5 "2006-08-22T17:06:36Z")

</div>

On Aug 22, 2006, at 3:45 AM, Pål Bergström wrote:

> But how then do you use the others? Will a rake command automatically  
> add the stuff from development to production, when ready? Or how  
> does it  
> work?

Migrations are technology sufficiently advanced as to appear to be  
magic. 🙂

–  
– Tom M.

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [August 22, 2006, 12:45pm UTC](https://www.ruby-forum.com/t/development-test-and-production-what-for/65908/6 "2006-08-22T12:45:57Z")

</div>

PÃ¥l BergstrÃ¶m wrote:

> What happens when  
> using the rake to create the db? Will that add or change in them all? (I  
> could also try this so you don’t have to answer, if you don’t feel like  
> it)

And no. It doesn’t. Stupid question I guess. A change in development  
shouldn’t affect production mode instantly.

But how then do you use the others? Will a rake command automatically  
add the stuff from development to production, when ready? Or how does it  
work?
