Search code examples
ruby-on-rails-4rails-migrations

What does `first: true` do while defining migrations in Rails?


I was going through Codeschool's courses for learning Rails. There, they have placed a PDF file that contains a summary of all the options while writing migrations for defining an individual column like default: <value>, limit: <number>, unique: true. There is an option first: true, that I'm unable to understand.

Apparently, it seems that it is gonna change the position of the column to the first column in the table, but it doesn't seem to do anything like that. What exactly does it do?


Solution

  • When defining the columns you can determine their order by using first: true and after: column_name. I couldn't find it documented anywhere, but you can see it in the sources.