class AddSkillLevelToPositionsUsers < ActiveRecord::Migration[5.0]
  def change
    add_column :positions_users, :skill_level, :integer

    PositionsUser.reset_column_information

    PositionsUser.all.each do |pu|
      pu.skill_level = 3
      pu.save
    end

    change_column :positions_users, :skill_level, :integer, null: false
  end
end

Add Skill Level Attribute to PositionsUser
Add Skill Level Attribute to PositionsUser

PositionUser table already has a few rows.  Migration assigns an initial value
to the new skill_level attribute, then changes the column to not-null for
future rows.
