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
erp_financial_accounting-3.1.0 spec/dummy/db/migrate/20130107180910_upgrade_security.erp_tech_svcs.rb
erp_communication_events-3.1.0 spec/dummy/db/migrate/20130107180830_upgrade_security.erp_tech_svcs.rb
erp_work_effort-3.1.0 spec/dummy/db/migrate/20130107180755_upgrade_security.erp_tech_svcs.rb
erp_inventory-3.1.0 spec/dummy/db/migrate/20130107180715_upgrade_security.erp_tech_svcs.rb
erp_commerce-3.1.0 spec/dummy/db/migrate/20130107214956_upgrade_security.erp_tech_svcs.rb
erp_txns_and_accts-3.1.0 spec/dummy/db/migrate/20130107214863_upgrade_security.erp_tech_svcs.rb
erp_orders-3.1.0 spec/dummy/db/migrate/20130107214808_upgrade_security.erp_tech_svcs.rb
erp_products-3.1.0 spec/dummy/db/migrate/20130107214717_upgrade_security.erp_tech_svcs.rb
erp_agreements-3.1.0 spec/dummy/db/migrate/20130107214624_upgrade_security.erp_tech_svcs.rb
erp_app-3.1.0 spec/dummy/db/migrate/20130107214539_upgrade_security.erp_tech_svcs.rb
erp_tech_svcs-3.1.0 spec/dummy/db/migrate/20130107214449_upgrade_security.erp_tech_svcs.rb