Sha256: 97be4ff36ee7543e213c2222e428fbfd313b5db407af1486ecc74236bf015df2

Contents?: true

Size: 908 Bytes

Versions: 1

Compression:

Stored size: 908 Bytes

Contents

class AddCreatedByUpdatedByToErpTechSvcs < ActiveRecord::Migration
  def up
    %w{file_assets}.each do |table|

      unless column_exists? table.to_sym, :created_by_party_id
        add_column table.to_sym, :created_by_party_id, :integer

        add_index table.to_sym, :created_by_party_id, name: "#{table}_created_by_pty_idx"
      end

      unless column_exists? table.to_sym, :updated_by_party_id
        add_column table.to_sym, :updated_by_party_id, :integer

        add_index table.to_sym, :updated_by_party_id, name: "#{table}_updated_by_pty_idx"
      end

    end

  end

  def down
    %w{file_assets}.each do |table|

      if column_exists? table.to_sym, :created_by_party_id
        remove_column table.to_sym, :created_by_party_id
      end

      if column_exists? table.to_sym, :updated_by_party_id
        remove_column table.to_sym, :updated_by_party_id
      end
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
erp_tech_svcs-4.2.0 db/migrate/20160310163060_add_created_by_updated_by_to_erp_tech_svcs.rb