Table creation using migration


#1

Hi…

to create a table with relationship to the other table…using the
migration how does we do that

table1 : id
field1,
field2,
table2 : id
field_table1_id,
field2,
field3,

there is one to many relationship between table1 to table2…

how do we create this using migration…


#2

moo wrote:

there is one to many relationship between table1 to table2…

how do we create this using migration…

Using the create_table method, which I am sure you can find the
instructions for in the API reference.

The database doesn’t care about your one to many relation ship, so don’t
worry about that when doing the migration. That goes into your model.


Jakob S. - http://mentalized.net


#3

moo wrote:

how do we create this using migration…

You do it in your models :slight_smile: