two tables in one migration file?

i already have 10_create_comments migration file. that file contains create_table :comments do |t|       t.column :title, :text       t.column :foto_id, :integer       t.column :user_id, :integer       t.column :created_at, :datetime       t.column :updated_at, :datetime     end

this is design for photo commenting purpose. i i need another comment setup under the message so how do i use this migration file to that? any ideas?

nirosh

Your current create_table should appear in the self.up section of the migration... self.down should undo any operation that self.up performs (where reasonable).

There's nothing stopping you from adding another create_table statement as long as its properly formatted.

You'll probably hear all sorts of opinions about mixing more than one action in a single migration step. If you do create more than one table, realize that the migration becomes an all or nothing choice, both tables or neither.

You can code it however you want of course, but what is so bad about adding another migration for the message comments?

between comments and several (at least two) other models in your application. Check out has_many_polymorphs, and simplify your development.