Sha256: 9fe1de371c050e3f034dca3f28eaeff6aab2d5681e7cde0320b04e5884b6968d

Contents?: true

Size: 441 Bytes

Versions: 2

Compression:

Stored size: 441 Bytes

Contents

class AlterRecordHistoriesAddTransactionId < ActiveRecord::Migration
  def self.up
    add_column :record_histories, :transaction_id, :decimal
    RecordHistoryModel.update_all("transaction_id = extract(epoch from created_at)")
    change_column :record_histories, :transaction_id, :decimal, :null => false
    add_index :record_histories, :transaction_id
  end
  def self.down
    remove_column :record_histories, :transaction_id
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
record_history-0.8.9 lib/generators/record_history/templates/alter_record_histories_add_transaction_id.rb
record_history-0.8.8 lib/generators/record_history/templates/alter_record_histories_add_transaction_id.rb