# Running single migration file

**URL:** <https://www.ruby-forum.com/t/running-single-migration-file/136132>\
**Category:** Rails\
**Created:** [April 29, 2008, 9:28am UTC](https://www.ruby-forum.com/t/running-single-migration-file/136132 "2008-04-29T09:28:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![karthikragu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a88e57/32.png) [@karthikragu](https://www.ruby-forum.com/u/karthikragu)\
**Post date:** [April 29, 2008, 9:28am UTC](https://www.ruby-forum.com/t/running-single-migration-file/136132/1 "2008-04-29T09:28:18Z")

</div>

hi all,

```
     in my db/migrate folder im having many migrations files that

```

creates tables,add columns,and remove columns.i created a new migration  
file now and can i run only this new migration file using rake  
command.how to run a specific migration using rake command.people know  
it help me please.

---

<div class="post-metadata">

**Author:** ![karthikragu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a88e57/32.png) [@karthikragu](https://www.ruby-forum.com/u/karthikragu)\
**Post date:** [April 29, 2008, 2:28pm UTC](https://www.ruby-forum.com/t/running-single-migration-file/136132/2 "2008-04-29T14:28:22Z")

</div>

On Apr 29, 2008, at 3:28 AM, Karthikragunath B. wrote:

> hi all,
> 
> ```
> in my db/migrate folder im having many migrations files that
> 
> ```
> 
> creates tables,add columns,and remove columns.i created a new  
> migration  
> file now and can i run only this new migration file using rake  
> command.how to run a specific migration using rake command.people know  
> it help me please.

You can do:  
rake db:migrate VERSION=12  
to run the migrations necessary to get to version 12 from wherever you  
are. If the database is at version 11, that will cause the 012\_\* up  
migration to run, if at 13, the 012\_\* down migration will run. There  
is no command to pluck a particular migration out of the middle and  
run it (up or down).

Normally, you just add the migration and run: rake db:migrate  
and it does the right thing. I tend to make a backup of the  
development database and then run migrations forward VERSION=12 and  
then backward VERSION=11 until I’m sure that the migration is  
reversible (usually when there’s some non-trivial data-munging going  
on).

-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![karthikragu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a88e57/32.png) [@karthikragu](https://www.ruby-forum.com/u/karthikragu)\
**Post date:** [April 29, 2008, 2:38pm UTC](https://www.ruby-forum.com/t/running-single-migration-file/136132/3 "2008-04-29T14:38:59Z")

</div>

For specific updates you can manipulate the schema.rb file accordingly  
and  
load it.  
rake db:schema:dump dumps the schema and load does the opposite.  
So you can dump, include all the migration changes you want and load for  
a  
quick solution.

On Tue, Apr 29, 2008 at 12:58 PM, Karthikragunath B. \<
