Sha256: 5ed38aa3089c53a1cf15bf6bb3d10ada8b51ce292f6920ba2df9e0a34f562013

Contents?: true

Size: 763 Bytes

Versions: 23

Compression:

Stored size: 763 Bytes

Contents

class AddAlchemyRolesToAlchemyUsers < ActiveRecord::Migration[4.2]
  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

23 entries across 23 versions & 1 rubygems

Version Path
alchemy-devise-7.3.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-7.2.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-7.1.2 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-7.1.1 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-7.1.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-7.0.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-6.3.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-6.2.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-6.1.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-6.0.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-5.1.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-5.0.1 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-5.0.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-4.6.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-4.5.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-4.4.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-4.3.1 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-4.3.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-4.2.1 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
alchemy-devise-4.2.0 db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb