Sha256: 7f160042ad2fc8975b28c9743656b3de6c786e125776dfd1f1815daf0bce915e

Contents?: true

Size: 466 Bytes

Versions: 2

Compression:

Stored size: 466 Bytes

Contents

class AlterRecordHistoriesAddTransactionId < ActiveRecord::Migration
  def self.up
    add_column :record_histories, :transaction_id, :decimal
    RecordHistoryModel.all.each do |rec|
    	rec.transaction_id = rec.created_at.to_f
      rec.save
    end
    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.9.1 lib/generators/record_history/templates/alter_record_histories_add_transaction_id.rb
record_history-0.9.0 lib/generators/record_history/templates/alter_record_histories_add_transaction_id.rb