File tree Expand file tree Collapse file tree
test/dummy/config/initializers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11module SqliteImmediateTransactions
22 def begin_db_transaction
3- if Rails . gem_version < Gem ::Version . new ( "8.2" )
4- log ( "begin immediate transaction" , "TRANSACTION" ) do
5- with_raw_connection ( allow_retry : true , materialize_transactions : false ) do |conn |
6- conn . transaction ( :immediate )
7- end
3+ log ( "begin immediate transaction" , "TRANSACTION" ) do
4+ with_raw_connection ( allow_retry : true , materialize_transactions : false ) do |conn |
5+ conn . transaction ( :immediate )
86 end
97 end
108 end
@@ -26,7 +24,10 @@ def configure_connection
2624
2725ActiveSupport . on_load :active_record do
2826 if defined? ( ActiveRecord ::ConnectionAdapters ::SQLite3Adapter )
29- ActiveRecord ::ConnectionAdapters ::SQLite3Adapter . prepend SqliteImmediateTransactions
27+ # Rails 8.0+ has immediate transactions built-in
28+ if Rails ::VERSION ::MAJOR < 8
29+ ActiveRecord ::ConnectionAdapters ::SQLite3Adapter . prepend SqliteImmediateTransactions
30+ end
3031 ActiveRecord ::ConnectionAdapters ::SQLite3Adapter . prepend SQLite3Configuration
3132 end
3233
You can’t perform that action at this time.
0 commit comments