File tree Expand file tree Collapse file tree
lib/active_record/connection_adapters Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -90,6 +90,25 @@ class RedshiftAdapter < AbstractAdapter
9090 include Redshift ::SchemaStatements
9191 include Redshift ::DatabaseStatements
9292
93+ # Rails 8.1+ compatibility: mark_transaction_written_if_write was removed
94+ # and replaced with mark_transaction_written (no parameters).
95+ # This method provides backward compatibility for our adapter.
96+ if ActiveRecord . version >= Gem ::Version . new ( '8.1.0' )
97+ def mark_transaction_written_if_write ( sql ) # :nodoc:
98+ transaction = current_transaction
99+ if transaction . open? && write_query? ( sql )
100+ mark_transaction_written
101+ end
102+ end
103+ end
104+
105+ # Compatibility: in_transaction? is defined in PostgreSQLAdapter but not in AbstractAdapter.
106+ # Since RedshiftAdapter inherits from AbstractAdapter (not PostgreSQLAdapter),
107+ # we need to provide this method. It's used for prepared statement cache handling.
108+ def in_transaction? # :nodoc:
109+ open_transactions > 0
110+ end
111+
93112 def schema_creation # :nodoc:
94113 Redshift ::SchemaCreation . new self
95114 end
You can’t perform that action at this time.
0 commit comments