# Changes in a Production Environment

**URL:** <https://www.ruby-forum.com/t/changes-in-a-production-environment/134197>\
**Category:** Rails\
**Created:** [April 8, 2008, 8:25pm UTC](https://www.ruby-forum.com/t/changes-in-a-production-environment/134197 "2008-04-08T20:25:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rodrigo\_MuiSSSSo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ac8455/32.png) [@Rodrigo\_MuiSSSSo](https://www.ruby-forum.com/u/Rodrigo_MuiSSSSo)\
**Post date:** [April 8, 2008, 8:25pm UTC](https://www.ruby-forum.com/t/changes-in-a-production-environment/134197/1 "2008-04-08T20:25:08Z")

</div>

Hi guys, I am planning to make some changes in a Production environment.  
This include changes in the model.  
I was thinking about making a backup of the database, then running  
migrations to zero, making a svn update, running the migrations and then  
restoring the database.

Many would ask why I am making a rollback of migrations and then running  
them again. It seems that we made some changes to old migrations, so I  
prefer doing it this way.

Do you recommend me anything else?

Thanks a lot  
Rodrigo

---

<div class="post-metadata">

**Author:** ![Rodrigo\_MuiSSSSo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ac8455/32.png) [@Rodrigo\_MuiSSSSo](https://www.ruby-forum.com/u/Rodrigo_MuiSSSSo)\
**Post date:** [April 8, 2008, 8:37pm UTC](https://www.ruby-forum.com/t/changes-in-a-production-environment/134197/2 "2008-04-08T20:37:16Z")

</div>

Rodrigo MuiÃ±o wrote:

> Hi guys, I am planning to make some changes in a Production environment.  
> This include changes in the model.  
> I was thinking about making a backup of the database, then running  
> migrations to zero, making a svn update, running the migrations and then  
> restoring the database.

Restore, how?

If there are any changes made to the schema then how is your restore  
going to handle them?

---

<div class="post-metadata">

**Author:** ![Rodrigo\_MuiSSSSo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ac8455/32.png) [@Rodrigo\_MuiSSSSo](https://www.ruby-forum.com/u/Rodrigo_MuiSSSSo)\
**Post date:** [April 8, 2008, 8:53pm UTC](https://www.ruby-forum.com/t/changes-in-a-production-environment/134197/3 "2008-04-08T20:53:37Z")

</div>

I analyzed that I wouldn’t have to make data changes to restore the  
whole  
info. We added some text columns in two tables which have no  
restrictions  
and created some tables that references another table we already had.

I would backup only data with:  
mysqldump -u _username_ -p_password_ â€“no-create-info _database\_name_ \> \*  
dump.sql

_and restore it with:  
mysql -u username -p_ password\* _database\_name_ \< \*dump.sql

Am I missing anything?

Thanks  
Rodrigo

- 

On Tue, Apr 8, 2008 at 3:37 PM, James B. \<

---

<div class="post-metadata">

**Author:** ![Rodrigo\_MuiSSSSo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ac8455/32.png) [@Rodrigo\_MuiSSSSo](https://www.ruby-forum.com/u/Rodrigo_MuiSSSSo)\
**Post date:** [April 8, 2008, 10:20pm UTC](https://www.ruby-forum.com/t/changes-in-a-production-environment/134197/4 "2008-04-08T22:20:17Z")

</div>

Rodrigo MuiÃ±o wrote:

> I analyzed that I wouldn’t have to make data changes to restore the  
> whole info. We added some text columns in two tables which have no  
> restrictions and created some tables that references another table  
> we already had.
> 
> I would backup only data with:  
> mysqldump -u _username_ -p_password_ â€“no-create-info _database\_name_ \> \*  
> dump.sql
> 
> _and restore it with:  
> mysql -u username -p_ password\* _database\_name_ \< \*dump.sql
> 
> Am I missing anything?
> 
> Thanks  
> Rodrigo

If all you are doing is adding columns to several tables and several  
tables and related columns to an existing database then what benefit  
does a dump and restore give you? The major benefit of migrations is to  
leverage the ALTER TABLE capability of SQL to insert and remove columns  
without having to dump and restore.

---

<div class="post-metadata">

**Author:** ![Rodrigo\_MuiSSSSo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ac8455/32.png) [@Rodrigo\_MuiSSSSo](https://www.ruby-forum.com/u/Rodrigo_MuiSSSSo)\
**Post date:** [April 8, 2008, 11:49pm UTC](https://www.ruby-forum.com/t/changes-in-a-production-environment/134197/5 "2008-04-08T23:49:40Z")

</div>

On 8 Apr 2008, at 22:08, Rodrigo Muiño wrote:

> James, Thanks for your answer. We’ll take it into account for the  
> future.  
> Now we need to do it the other way because we made changes in older  
> migrations.  
> You learn better of your own mistakes.

I think you’d be better off just writing whatever migrations you need  
to make your production environment right. For me at least, the  
production database (and not the set of migrations and bits that got  
you there) is the baseline.

Fred

---

<div class="post-metadata">

**Author:** ![Rodrigo\_MuiSSSSo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ac8455/32.png) [@Rodrigo\_MuiSSSSo](https://www.ruby-forum.com/u/Rodrigo_MuiSSSSo)\
**Post date:** [April 8, 2008, 11:08pm UTC](https://www.ruby-forum.com/t/changes-in-a-production-environment/134197/6 "2008-04-08T23:08:40Z")

</div>

James, Thanks for your answer. We’ll take it into account for the  
future.  
Now we need to do it the other way because we made changes in older  
migrations.  
You learn better of your own mistakes.

Rodrigo

On Tue, Apr 8, 2008 at 5:20 PM, James B. \<
