Sha256: 2180004109e54d0a875b1be2a03787e2f5ac1dc7f05ff466d3a9f01eab9f2b24

Contents?: true

Size: 434 Bytes

Versions: 1

Compression:

Stored size: 434 Bytes

Contents

class AddAdministratorToUsers < ActiveRecord::Migration
  def up
    add_column :users, :administrator, :boolean, :default => false
    
    User.unscoped do
      User.where(role: "Administrator").update_all(administrator: true, role: "Developer")
    end
  end
  
  def down
    User.unscoped do
      User.where(administrator: true).update_all(role: "Administrator")
    end
    
    remove_column :users, :administrator
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
houston-core-0.5.0.beta1 db/migrate/20120920023251_add_administrator_to_users.rb