Sha256: fd4e3fb79058010404e17957d4b91fa40327dd8f69f5bf9c016aa6e23bbd9968

Contents?: true

Size: 758 Bytes

Versions: 13

Compression:

Stored size: 758 Bytes

Contents

class AddAlchemyRolesToAlchemyUsers < ActiveRecord::Migration
  def up
    # Updating old :roles column (since Alchemy CMS v2.6)
    if column_exists?(:alchemy_users, :roles)
      rename_column :alchemy_users, :roles, :alchemy_roles
      change_column :alchemy_users, :alchemy_roles, :string, default: "member"
    end

    # Creating :alchemy_roles column for new apps.
    unless column_exists?(:alchemy_users, :alchemy_roles)
      add_column :alchemy_users, :alchemy_roles, :string, default: "member"
    end

    # Renaming the index
    if index_exists?(:alchemy_users, :roles)
      remove_index :alchemy_users, :roles
    end
    unless index_exists?(:alchemy_users, :alchemy_roles)
      add_index :alchemy_users, :alchemy_roles
    end
  end
end

Version data entries

13 entries across 10 versions & 1 rubygems

Version Path
alchemy-devise-3.6.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-3.5.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-3.5.0.beta db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-3.4.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-3.3.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-3.2.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-3.2.0 spec/dummy/db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-2.1.0 spec/dummy/db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-2.1.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-2.1.0.beta3 spec/dummy/db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-2.1.0.beta3 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-2.1.0.beta2 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-2.1.0.beta1 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb