Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duelinmarkers/124302 to your computer and use it in GitHub Desktop.
Save duelinmarkers/124302 to your computer and use it in GitHub Desktop.
# Allows you to specify the position of a column in your migrations' add_column and change_column calls.
ActiveRecord::ConnectionAdapters::MysqlAdapter.class_eval do
def add_column_options!(sql, options)
super
if options[:after]
sql << " AFTER #{quote_column_name(options[:after])}"
elsif options[:first]
sql << " FIRST"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment