Sha256: 4f07822906db3572155ff89c143497191004aaddcbc164218ebfe5d1590dd0b2

Contents?: true

Size: 1.21 KB

Versions: 52

Compression:

Stored size: 1.21 KB

Contents

# This migration comes from erp_tech_svcs (originally 20111117183144)
class CreateHasAttributeTables < ActiveRecord::Migration
  def up
    unless table_exists?(:attribute_types)
      create_table :attribute_types do |t|
        t.string :internal_identifier
        t.string :description
        t.string :data_type

        t.timestamps
      end

      add_index :attribute_types, :internal_identifier,  :name => ':attribute_types_iid_idx'
    end
    unless table_exists?(:attribute_values)
      create_table :attribute_values do |t|
        t.integer :attributed_record_id
        t.string :attributed_record_type
        t.references :attribute_type
        t.string  :value

        t.timestamps
      end

      add_index :attribute_values, [:attributed_record_id, :attributed_record_type], :name => 'attribute_values_attributed_record_idx'
      add_index :attribute_values, :attribute_type_id,  :name => 'attribute_values_attributed_type_idx'
      add_index :attribute_values, :value,  :name => 'attribute_values_value_idx'
    end
  end

  def down
    if table_exists?(:attribute_types)
      drop_table :attribute_types
    end
    if table_exists?(:attribute_values)
      drop_table :attribute_values
    end
  end
end

Version data entries

52 entries across 52 versions & 18 rubygems

Version Path
erp_financial_accounting-3.1.0 spec/dummy/db/migrate/20121213234215_create_has_attribute_tables.erp_tech_svcs.rb
erp_communication_events-3.1.0 spec/dummy/db/migrate/20121213233559_create_has_attribute_tables.erp_tech_svcs.rb
compass_ae_console-2.0.0 spec/dummy/db/migrate/20121207195351_create_has_attribute_tables.erp_tech_svcs.rb
erp_work_effort-3.1.0 spec/dummy/db/migrate/20121219191146_create_has_attribute_tables.erp_tech_svcs.rb
erp_inventory-3.1.0 spec/dummy/db/migrate/20121213235620_create_has_attribute_tables.erp_tech_svcs.rb
erp_commerce-3.1.0 spec/dummy/db/migrate/20130107214954_create_has_attribute_tables.erp_tech_svcs.rb
erp_txns_and_accts-3.1.0 spec/dummy/db/migrate/20130107214861_create_has_attribute_tables.erp_tech_svcs.rb
erp_orders-3.1.0 spec/dummy/db/migrate/20130107214806_create_has_attribute_tables.erp_tech_svcs.rb
erp_products-3.1.0 spec/dummy/db/migrate/20130107214715_create_has_attribute_tables.erp_tech_svcs.rb
erp_agreements-3.1.0 spec/dummy/db/migrate/20130107214622_create_has_attribute_tables.erp_tech_svcs.rb
erp_app-3.1.0 spec/dummy/db/migrate/20130107214537_create_has_attribute_tables.erp_tech_svcs.rb
erp_tech_svcs-3.1.0 spec/dummy/db/migrate/20130107214447_create_has_attribute_tables.erp_tech_svcs.rb