Module: Changebase::Inline::ActiveRecord::PostgreSQLAdapter

Defined in:
lib/changebase/inline/active_record.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#changebase_transactionObject (readonly)

Returns the value of attribute changebase_transaction.



67
68
69
# File 'lib/changebase/inline/active_record.rb', line 67

def changebase_transaction
  @changebase_transaction
end

Instance Method Details

#begin_db_transactionObject

Begins a transaction.



70
71
72
73
74
75
76
# File 'lib/changebase/inline/active_record.rb', line 70

def begin_db_transaction
  super
  @changebase_transaction = Changebase::Inline::Transaction.new(
    timestamp: Time.current,
    metadata: @changebase_metadata
  )
end

#commit_db_transactionObject

Commits a transaction.



86
87
88
89
90
# File 'lib/changebase/inline/active_record.rb', line 86

def commit_db_transaction
  @changebase_transaction&.save!
  @changebase_transaction = nil
  super
end

#exec_rollback_db_transactionObject

Aborts a transaction.



79
80
81
82
83
# File 'lib/changebase/inline/active_record.rb', line 79

def exec_rollback_db_transaction
  super
ensure
  @changebase_transaction = nil
end