This project is archived and is in readonly mode.

#3286 ✓committed
Ben Marini

[PATCH] Add support for Mysql column positioning to migrations

Reported by Ben Marini | September 28th, 2009 @ 12:48 AM

This patch allows some extra options to be passed for #add_column and #change_column

From the mysql docs for alter table (
"To add a column at a specific position within a table row, use FIRST or AFTER col_name."

Here are the new options:
:first => true # Put the column in front of all the columns :after => column_name # Put the colmn after 'column_name'

Here is an example:

# Inside of a migration ...
add_column :new_col, :string, :first => true
add_column :another_col, :integer, :default => 0, :after => :new_col

Patch contains tests and applies cleanly to 2-3-stable and master. This is my first patch so any pointers would be appreciated, thanks!

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

Shared Ticket Bins