Sha256: a8c3a5551d44610060612d527cc1eb2f740e622ca60fb1ebd41735d235fee836

Contents?: true

Size: 1.25 KB

Versions: 6

Compression:

Stored size: 1.25 KB

Contents

class AddTxnStatus < ActiveRecord::Migration
  def up
    unless table_exists?(:status_applications)
      create_table :status_applications do |t|
        t.references :tracked_status_type
        t.references :status_application_record, :polymorphic => true
        t.datetime  :from_date
        t.datetime  :thru_date

        t.timestamps
      end

      add_index :status_applications, [:status_application_record_id, :status_application_record_type], :name => 'status_applications_record_idx'
      add_index :status_applications, :tracked_status_type_id, :name => 'tracked_status_type_id_idx'
      add_index :status_applications, :from_date, :name => 'from_date_idx'
      add_index :status_applications, :thru_date, :name => 'thru_date_idx'
    end

    unless table_exists?(:tracked_status_types)
      create_table :tracked_status_types do |t|
        t.string :description
        t.string :internal_identifier
        t.string :external_identifier

        t.timestamps
      end

      add_index :tracked_status_types, :internal_identifier, :name => 'tracked_status_types_iid_idx'
    end
  end

  def down
    drop_table :status_applications if table_exists?(:status_applications)
    drop_table :tracked_status_types if table_exists?(:tracked_status_types)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
erp_base_erp_svcs-4.0.0 db/migrate/20120606183856_add_txn_status.rb
erp_base_erp_svcs-3.1.5 db/migrate/20120606183856_add_txn_status.rb
erp_base_erp_svcs-3.1.4 db/migrate/20120606183856_add_txn_status.rb
erp_base_erp_svcs-3.1.3 db/migrate/20120606183856_add_txn_status.rb
erp_base_erp_svcs-3.1.2 db/migrate/20120606183856_add_txn_status.rb
erp_base_erp_svcs-3.1.1 db/migrate/20120606183856_add_txn_status.rb