discourse/db/migrate/20150730154830_add_position_to_user_fields.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

9 lines
296 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class AddPositionToUserFields < ActiveRecord::Migration[4.2]
2015-07-31 02:52:53 +08: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