# Deploying and migrations

**URL:** <https://www.ruby-forum.com/t/deploying-and-migrations/114100>\
**Category:** Rails\
**Created:** [September 7, 2007, 10:25pm UTC](https://www.ruby-forum.com/t/deploying-and-migrations/114100 "2007-09-07T22:25:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 7, 2007, 10:25pm UTC](https://www.ruby-forum.com/t/deploying-and-migrations/114100/1 "2007-09-07T22:25:43Z")

</div>

I’ve got an app running on a remote server in production env that I’ve  
been deploying with capistrano. I recently added file 002 in db/  
migrate. I did a cap deploy\_with\_migrations and it wiped out all of  
my data. I think this is becuase 001 was still in db/migrate, and it  
just overwrote everything.

Are you supposed to wipe out the the previous migrations when  
deploying, so only the most recent is acted upon?

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 7, 2007, 10:48pm UTC](https://www.ruby-forum.com/t/deploying-and-migrations/114100/2 "2007-09-07T22:48:48Z")

</div>

On Sep 7, 2007, at 4:24 PM, removed\_email\_address@domain.invalid wrote:

> Are you supposed to wipe out the the previous migrations when  
> deploying, so only the most recent is acted upon?

No – the schema\_info table should keep track of what version you’re  
on at the moment, so a “rake db:migrate” only runs the migrations  
necessary. If you were at version 1 before it should only have run  
migration #2.

-faisal
