# Migration

**URL:** <https://www.ruby-forum.com/t/migration/136892>\
**Category:** Rails\
**Created:** [May 7, 2008, 6:14am UTC](https://www.ruby-forum.com/t/migration/136892 "2008-05-07T06:14:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![validkeys](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/da6949/32.png) [@validkeys](https://www.ruby-forum.com/u/validkeys)\
**Post date:** [May 7, 2008, 6:14am UTC](https://www.ruby-forum.com/t/migration/136892/1 "2008-05-07T06:14:56Z")

</div>

quick n00b question. If I am working on one computer on a new rails  
app, commit it to SVN, and then checkout to another computer. Once I  
create the database (without tables), When i run rake db:migrate, will  
it run all migrations on the new computer so that the database  
structure is the exact same as the original computer that I was  
working on?

I guess the question here is if you move a rails app with several  
migrations to another computer and run the rake script, will it  
iterate through all migrations effectively creating the same database  
or will it only run the last migration.

Thanks

Im sure this question is retarded.

---

<div class="post-metadata">

**Author:** ![validkeys](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/da6949/32.png) [@validkeys](https://www.ruby-forum.com/u/validkeys)\
**Post date:** [May 7, 2008, 7:15am UTC](https://www.ruby-forum.com/t/migration/136892/2 "2008-05-07T07:15:51Z")

</div>

It will run all migrations that have not been ran on that computer.

Computer A has 5 migrations, and has ran them all. Computer B has only  
three  
and has ran only two. Computer A commits to the repository the other  
two,  
computer B does an “svn up” and gets two more, runs rake db:migrate and  
it  
will run these two new ones as well as the one that hasn’t been run.

---

<div class="post-metadata">

**Author:** ![validkeys](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/da6949/32.png) [@validkeys](https://www.ruby-forum.com/u/validkeys)\
**Post date:** [May 7, 2008, 5:00pm UTC](https://www.ruby-forum.com/t/migration/136892/3 "2008-05-07T17:00:21Z")

</div>

Just to clarify…

As a result of running migrations you’ll get a table in your db called  
‘schema\_info’ that has only one column (version). That table is used  
to track the number of the last migration run against the DB. So, if  
you check out the project on a new PC, create the DB (rake  
db:create:all), and migrate, you’ll create the schema\_info table with  
no value in version, then run each migration in turn until you hit the  
last. In the future, if you add more migrations they can also be  
checked out to the other PC and db:migrate will recognize that the  
current migration set has newer migration than is reflected in  
schema\_info and will only run the unexecuted migrations.

BTW, the actual implementation of this is scheduled for change in 2.1  
(timestamped migrations) but the net result is the same.
