Sha256: 3accad944439af425ca0f6cbf44b55dde11471b66e969089288a0a25bb7cbbc7

Contents?: true

Size: 1.02 KB

Versions: 33

Compression:

Stored size: 1.02 KB

Contents

class RemoveUserStatus < ActiveRecord::Migration
  def self.up
    Zena::Db.update_value('sites_users.status', :from => 'users.status',
                          :where => 'users.id=sites_users.user_id')
    remove_column :users, 'status'

    add_column :sites_users, 'contact_id', :integer # contact page for the given site
    Zena::Db.update_value('sites_users.contact_id', :from => 'users.contact_id',
                          :where => 'users.id=sites_users.user_id')
    remove_column :users, 'contact_id'
    remove_column :sites, 'admin_group_id'
  end

  def self.down
    add_column :users, :status, :integer
    Zena::Db.update_value('users.status', :from => 'sites_users.status',
                          :where => "user.id=sites_users.user_id")

    add_column :users, 'contact_id', :integer # contact page for the given site

    Zena::Db.update_value('users.contact_id', :from => 'sites_users.contact_id',
                          :where => "user.id=sites_users.user_id")
    remove_column :sites_users, 'contact_id'
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
zena-1.2.8 db/fix/old_migrations/019_remove_user_status.rb
zena-1.2.7 db/fix/old_migrations/019_remove_user_status.rb
zena-1.2.6 db/fix/old_migrations/019_remove_user_status.rb
zena-1.2.5 db/fix/old_migrations/019_remove_user_status.rb
zena-1.2.4 db/fix/old_migrations/019_remove_user_status.rb
zena-1.2.3 db/fix/old_migrations/019_remove_user_status.rb
zena-1.2.2 db/fix/old_migrations/019_remove_user_status.rb
zena-1.2.1 db/fix/old_migrations/019_remove_user_status.rb
zena-1.2.0 db/fix/old_migrations/019_remove_user_status.rb
zena-1.1.3 db/fix/old_migrations/019_remove_user_status.rb
zena-1.1.2 db/fix/old_migrations/019_remove_user_status.rb
zena-1.1.1 db/fix/old_migrations/019_remove_user_status.rb
zena-1.1.0 db/fix/old_migrations/019_remove_user_status.rb
zena-1.0.0 db/fix/old_migrations/019_remove_user_status.rb
zena-1.0.0.rc3 db/fix/old_migrations/019_remove_user_status.rb
zena-1.0.0.rc2 db/fix/old_migrations/019_remove_user_status.rb
zena-1.0.0.rc1 db/fix/old_migrations/019_remove_user_status.rb
zena-0.16.9 db/migrate/019_remove_user_status.rb
zena-1.0.0.beta3 db/migrate/019_remove_user_status.rb
zena-0.16.8 db/migrate/019_remove_user_status.rb