开发者

Creating (Dropping) Multiple Tables in One Migration

Is it possible to create (self.up) multiple tables in one rails three migration. If this is possible, what is the conventional wisdom on using such an approach. Something tells me i开发者_StackOverflow中文版t would be better form to keep one table per migration, but I'd just thought I check with some more seasoned ruby on railers.

Thanks.


The overall idea of migrations is to have the database schema in version control. So I personally think that it is more important to have one migration per "feature". For example, if you have an application for Pleople(name, prename) and you want to add a phone number, you would add this change to a migration. If, with the phone number you want to implement some remote lookup, you might need a caching table. I would still add that to the same migration.

There is one advantage of splitting up table creations: You can manually rewind the migrations per table.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜