Sha256: 2005ccd9bcc52d2ea6276296828835529bede5285e4077312e67a6a24094d2fc

Contents?: true

Size: 444 Bytes

Versions: 15

Compression:

Stored size: 444 Bytes

Contents

class AddRoleToUsers < ActiveRecord::Migration[5.2]
  def up
    add_column :users, :role, :integer, default: 0

    User.where(admin: true).each do |user|
      user.update_attribute(:role, :admin)
    end

    User.where(admin_limited_access: true).each do |user|
      user.update_attribute(:role, :admin_limited_access)
    end

    remove_column :users, :admin, :boolean
    remove_column :users, :admin_limited_access, :boolean
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
hackathon_manager-0.14.1 db/migrate/20190118204143_add_role_to_users.rb
hackathon_manager-0.14.0 db/migrate/20190118204143_add_role_to_users.rb
hackathon_manager-0.13.12 db/migrate/20190118204143_add_role_to_users.rb
hackathon_manager-0.13.11 db/migrate/20190118204143_add_role_to_users.rb
hackathon_manager-0.13.10 db/migrate/20190118204143_add_role_to_users.rb
hackathon_manager-0.13.9 db/migrate/20190118204143_add_role_to_users.rb
hackathon_manager-0.13.8 db/migrate/20190118204143_add_role_to_users.rb
hackathon_manager-0.13.7 db/migrate/20190118204143_add_role_to_users.rb
hackathon_manager-0.13.6 db/migrate/20190118204143_add_role_to_users.rb
hackathon_manager-0.13.5 db/migrate/20190118204143_add_role_to_users.rb
hackathon_manager-0.13.4 db/migrate/20190118204143_add_role_to_users.rb
hackathon_manager-0.13.3 db/migrate/20190118204143_add_role_to_users.rb
hackathon_manager-0.13.2 db/migrate/20190118204143_add_role_to_users.rb
hackathon_manager-0.13.1 db/migrate/20190118204143_add_role_to_users.rb
hackathon_manager-0.13.0 db/migrate/20190118204143_add_role_to_users.rb