2017-08-31 00:06:56 -04:00
|
|
|
class AddPositionToUserFields < ActiveRecord::Migration[4.2]
|
2015-07-30 14:52:53 -04:00
|
|
|
def change
|
|
|
|
add_column :user_fields, :position, :integer, default: 0
|
|
|
|
execute "UPDATE user_fields SET position = (SELECT COUNT(*) from user_fields as uf2 where uf2.id < user_fields.id)"
|
|
|
|
end
|
|
|
|
end
|