# Migration or model first

**URL:** <https://www.ruby-forum.com/t/migration-or-model-first/63261>\
**Category:** Rails\
**Created:** [June 13, 2006, 5:44pm UTC](https://www.ruby-forum.com/t/migration-or-model-first/63261 "2006-06-13T17:44:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dark\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/48db29/32.png) [@Dark\_A](https://www.ruby-forum.com/u/Dark_A)\
**Post date:** [June 13, 2006, 5:44pm UTC](https://www.ruby-forum.com/t/migration-or-model-first/63261/1 "2006-06-13T17:44:36Z")

</div>

I sort of asked this the other day but with no replies. I’m new to rails  
btw.

Question: Is there a preferred way to create migrations ? What I’ve  
noticed  
is if I create a model first , it sets up the skelton of the migration.  
If I create a migration file and then do the model it attempt to create  
a  
migration file and not overide the one already in place. It seems to  
make  
sense  
to me to create the model first, letting Rails do it’s thing , yet in  
most  
of the tutorials I’ve worked through so far it creates the migration  
first.

TIA  
Stuart

---

<div class="post-metadata">

**Author:** ![Dark\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/48db29/32.png) [@Dark\_A](https://www.ruby-forum.com/u/Dark_A)\
**Post date:** [June 13, 2006, 5:50pm UTC](https://www.ruby-forum.com/t/migration-or-model-first/63261/2 "2006-06-13T17:50:48Z")

</div>

On 6/13/06, Dark A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Question: Is there a preferred way to create migrations ?

I’m not sure that there is One True Way to migrations. Personally, I  
usually have a decent idea of what I want in the database. So I will  
typically generate a migration, rake the migration to ensure it’s  
correct, then generate the model. I’m probably still a little “old  
school” too when it comes to generating application code since I often  
run a generate scaffold command and flesh out the scaffold.

I like having my database table in existance for the initial scaffold  
generation. :: shrug ::

-Curtis

---

<div class="post-metadata">

**Author:** ![Dark\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/48db29/32.png) [@Dark\_A](https://www.ruby-forum.com/u/Dark_A)\
**Post date:** [June 13, 2006, 6:22pm UTC](https://www.ruby-forum.com/t/migration-or-model-first/63261/3 "2006-06-13T18:22:06Z")

</div>

Another way to to confirm things are correct .sounds wise.

Stuart
