Sha256: 23ebf04b6a1145131f6b3cb8ea586447e8b38b19b61aaf24e2c9234ae3a81f63

Contents?: true

Size: 1.78 KB

Versions: 51

Compression:

Stored size: 1.78 KB

Contents

# This migration comes from erp_tech_svcs (originally 20121126171612)
class UpgradeSecurity < ActiveRecord::Migration

  def self.up
    unless table_exists?(:capability_accessors)
      create_table :capability_accessors do |t|
        t.string :capability_accessor_record_type
        t.integer :capability_accessor_record_id
        t.integer :capability_id
        t.timestamps
      end

      add_index :capability_accessors, :capability_id
      add_index :capability_accessors, [:capability_accessor_record_id, :capability_accessor_record_type], :name => 'capability_accessor_record_index'
    end

    unless columns(:capabilities).collect {|c| c.name}.include?('scope_query')
      add_column :capabilities, :description, :string
      add_column :capabilities, :capability_resource_type, :string
      add_column :capabilities, :capability_resource_id, :integer
      add_column :capabilities, :scope_type_id, :integer
      add_column :capabilities, :scope_query, :text

      add_index :capabilities, :scope_type_id
      add_index :capabilities, [:capability_resource_id, :capability_resource_type], :name => 'capability_resource_index'
    end

    unless table_exists?(:scope_types)
      create_table :scope_types do |t|
        t.string :description
        t.string :internal_identifier
        t.timestamps
      end

      add_index :scope_types, :internal_identifier
    end

    unless table_exists?(:parties_security_roles)
      create_table :parties_security_roles, :id => false do |t|
        t.integer :party_id
        t.integer :security_role_id
      end

      add_index :parties_security_roles, :party_id
      add_index :parties_security_roles, :security_role_id
    end

    rename_table :roles, :security_roles unless table_exists?(:security_roles)

  end

  def self.down
  end
end

Version data entries

51 entries across 51 versions & 17 rubygems

Version Path
knitkit-2.1.5 spec/dummy/db/migrate/20130107153236_upgrade_security.erp_tech_svcs.rb
erp_app-3.1.6 spec/dummy/db/migrate/20130105135837_upgrade_security.erp_tech_svcs.rb
erp_tech_svcs-3.1.3 spec/dummy/db/migrate/20130220143265_upgrade_security.erp_tech_svcs.rb
erp_products-3.1.1 spec/dummy/db/migrate/20130107214717_upgrade_security.erp_tech_svcs.rb
erp_commerce-3.1.1 spec/dummy/db/migrate/20130107214956_upgrade_security.erp_tech_svcs.rb
erp_search-3.1.1 spec/dummy/db/migrate/20130107181411_upgrade_security.erp_tech_svcs.rb
rails_db_admin-2.1.1 spec/dummy/db/migrate/20130107181643_upgrade_security.erp_tech_svcs.rb
knitkit-2.1.1 spec/dummy/db/migrate/20130107155527_upgrade_security.erp_tech_svcs.rb
erp_forms-3.0.0 spec/dummy/db/migrate/20130107181042_upgrade_security.erp_tech_svcs.rb
erp_tech_svcs-3.1.1 spec/dummy/db/migrate/20130107214449_upgrade_security.erp_tech_svcs.rb
erp_app-3.1.2 spec/dummy/db/migrate/20130107214539_upgrade_security.erp_tech_svcs.rb
erp_app-3.0.16 spec/dummy/db/migrate/20130105135837_upgrade_security.erp_tech_svcs.rb
erp_tech_svcs-3.0.12 spec/dummy/db/migrate/20130105133959_upgrade_security.erp_tech_svcs.rb
erp_app-3.1.1 spec/dummy/db/migrate/20130107214539_upgrade_security.erp_tech_svcs.rb
rails_db_admin-2.1.0 spec/dummy/db/migrate/20130107181643_upgrade_security.erp_tech_svcs.rb
knitkit-2.1.0 spec/dummy/db/migrate/20130107155527_upgrade_security.erp_tech_svcs.rb
erp_search-3.1.0 spec/dummy/db/migrate/20130107181411_upgrade_security.erp_tech_svcs.rb
erp_rules-3.1.0 spec/dummy/db/migrate/20130107181308_upgrade_security.erp_tech_svcs.rb
erp_invoicing-3.1.0 spec/dummy/db/migrate/20130107181156_upgrade_security.erp_tech_svcs.rb
erp_forms-2.1.0 spec/dummy/db/migrate/20130107181042_upgrade_security.erp_tech_svcs.rb