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_tech_svcs-3.1.8 spec/dummy/db/migrate/20130220143263_create_has_attribute_tables.erp_tech_svcs.rb
knitkit-2.1.14 spec/dummy/db/migrate/20130107153234_create_has_attribute_tables.erp_tech_svcs.rb
knitkit-2.1.13 spec/dummy/db/migrate/20130107153234_create_has_attribute_tables.erp_tech_svcs.rb
erp_forms-3.1.1 spec/dummy/db/migrate/20130105143902_create_has_attribute_tables.erp_tech_svcs.rb
erp_app-3.1.14 spec/dummy/db/migrate/20130422163127_create_has_attribute_tables.erp_tech_svcs.rb
knitkit-2.1.12 spec/dummy/db/migrate/20130107153234_create_has_attribute_tables.erp_tech_svcs.rb
erp_orders-3.1.1 spec/dummy/db/migrate/20130107205934_create_has_attribute_tables.erp_tech_svcs.rb
erp_work_effort-3.1.1 spec/dummy/db/migrate/20130107204432_create_has_attribute_tables.erp_tech_svcs.rb
erp_tech_svcs-3.1.5 spec/dummy/db/migrate/20130220143263_create_has_attribute_tables.erp_tech_svcs.rb
erp_app-3.1.12 spec/dummy/db/migrate/20130422163127_create_has_attribute_tables.erp_tech_svcs.rb
knitkit-2.1.9 spec/dummy/db/migrate/20130107153234_create_has_attribute_tables.erp_tech_svcs.rb
knitkit-2.1.8 spec/dummy/db/migrate/20130107153234_create_has_attribute_tables.erp_tech_svcs.rb
erp_tech_svcs-3.1.4 spec/dummy/db/migrate/20130220143263_create_has_attribute_tables.erp_tech_svcs.rb
erp_forms-3.1.0 spec/dummy/db/migrate/20130105143902_create_has_attribute_tables.erp_tech_svcs.rb
erp_app-3.1.10 spec/dummy/db/migrate/20130422163127_create_has_attribute_tables.erp_tech_svcs.rb
erp_app-3.1.9 spec/dummy/db/migrate/20130107214537_create_has_attribute_tables.erp_tech_svcs.rb
erp_app-3.1.8 spec/dummy/db/migrate/20130422163127_create_has_attribute_tables.erp_tech_svcs.rb
knitkit-2.1.7 spec/dummy/db/migrate/20130107155525_create_has_attribute_tables.erp_tech_svcs.rb
erp_txns_and_accts-3.1.1 spec/dummy/db/migrate/20130107205645_create_has_attribute_tables.erp_tech_svcs.rb
erp_commerce-3.1.3 spec/dummy/db/migrate/20130107205821_create_has_attribute_tables.erp_tech_svcs.rb