In a Rails Migration (MySQL), can you specify what position a new column should be?

前端 未结 5 1327
旧时难觅i
旧时难觅i 2020-12-08 18:36

If I\'m adding a column via MySQL, I can specify where in the table that column will be using the AFTER modifier. But if I do the add_column via a Rails migration, the colum

5条回答
  •  醉话见心
    2020-12-08 18:58

    This is now possible in Rails 2.3.6+ by passing the :after parameter

    https://rails.lighthouseapp.com/projects/8994/tickets/3286-patch-add-support-for-mysql-column-positioning-to-migrations

    To everyone that doesn't see the advantage in having this feature: do you never look at your database outside of the ORM? If I'm viewing in any sort of UI, I like having things like foreign keys, status columns, flags, etc, all grouped together. This doesn't impact the application, but definitely speeds up my ability to review data.

提交回复
热议问题