transaction_isolation_level 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.travis.yml +14 -0
- data/Gemfile +1 -0
- data/MIT-LICENSE +1 -1
- data/lib/transaction_isolation_level.rb +15 -8
- data/lib/transaction_isolation_level/adapter_patches.rb +2 -2
- data/lib/transaction_isolation_level/version.rb +1 -1
- data/test_all.sh +1 -1
- data/transaction_isolation_level.gemspec +0 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f7c7bd4d72868cdf5dcae292e1b412df6ed37cce2b5bfce08bb78dfa56f65896
|
4
|
+
data.tar.gz: 0f24cbc145a84c0c965617002fcd6441e6cf5cff0ad6d8fafec7d2bba4b75044
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa97461acb3cd742d392cf029b02d5c08deeb79c8f52610b68070a9c4df5c3de56d48936224168e50685d56be29dae5eac25fe7aaca0a1996243a895c3ce792c
|
7
|
+
data.tar.gz: 3af16a368cd138eedbef8157b619e1b72220c82442a0b6c18782f83f823bf6f36c5701af3b43ca4efdee34d3fd0bf01fadb31d3c1efd3be5727daa0afecbe190
|
data/.travis.yml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
sudo: false
|
3
|
+
language: ruby
|
4
|
+
cache: bundler
|
5
|
+
dist: bionic
|
6
|
+
rvm:
|
7
|
+
- 2.6
|
8
|
+
services:
|
9
|
+
- postgresql
|
10
|
+
- mysql
|
11
|
+
before_script:
|
12
|
+
- createdb -U postgres transaction_isolation_level_test
|
13
|
+
- mysqladmin -u root create transaction_isolation_level_test
|
14
|
+
script: ./test_all.sh
|
data/Gemfile
CHANGED
data/MIT-LICENSE
CHANGED
@@ -13,15 +13,22 @@ module ActiveRecord
|
|
13
13
|
# uses the ConnectionHandler#establish_connection method we override here to load our patches once
|
14
14
|
# ActiveRecord::Base#establish_connection has loaded the class to patch.
|
15
15
|
def establish_connection_with_isolation_level_adapter_patches(*args)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
if ActiveRecord::VERSION::MAJOR == 6 && ActiveRecord::VERSION::MINOR > 0
|
17
|
+
# establish_connection sets up a pool without actually literally establishing a connection any more,
|
18
|
+
# so we can patch the adapter after this require now
|
19
|
+
establish_connection_without_isolation_level_adapter_patches(*args)
|
20
|
+
require 'transaction_isolation_level/adapter_patches'
|
21
|
+
else
|
22
|
+
if (ActiveRecord::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR > 0) || ActiveRecord::VERSION::MAJOR > 5
|
23
|
+
# need to explicitly trigger load of the adapter for 5.1 and above, as from that point on its
|
24
|
+
# required only in establish_connection, and we don't have a way to insert our patches halfway
|
25
|
+
# through that method.
|
26
|
+
ConnectionSpecification::Resolver.new(Base.configurations).spec(args.last)
|
27
|
+
end
|
22
28
|
|
23
|
-
|
24
|
-
|
29
|
+
require 'transaction_isolation_level/adapter_patches'
|
30
|
+
establish_connection_without_isolation_level_adapter_patches(*args)
|
31
|
+
end
|
25
32
|
end
|
26
33
|
|
27
34
|
alias_method :establish_connection_without_isolation_level_adapter_patches, :establish_connection
|
@@ -24,7 +24,7 @@ module ActiveRecord
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
def transaction_with_isolation_level(options
|
27
|
+
def transaction_with_isolation_level(**options)
|
28
28
|
isolation_level = options.delete(:isolation_level)
|
29
29
|
minimum_isolation_level = options.delete(:minimum_isolation_level)
|
30
30
|
|
@@ -40,7 +40,7 @@ module ActiveRecord
|
|
40
40
|
raise IncompatibleTransactionIsolationLevel, "Asked to use transaction isolation level at least #{minimum_isolation_level}, but the transaction has already begun with isolation level #{@transaction_isolation_level || default_transaction_isolation_level}"
|
41
41
|
end
|
42
42
|
|
43
|
-
transaction_without_isolation_level(options) { yield }
|
43
|
+
transaction_without_isolation_level(**options) { yield }
|
44
44
|
end
|
45
45
|
|
46
46
|
alias :transaction_without_isolation_level :transaction
|
data/test_all.sh
CHANGED
@@ -6,7 +6,6 @@ spec = Gem::Specification.new do |gem|
|
|
6
6
|
gem.version = TransactionIsolationLevel::VERSION
|
7
7
|
gem.summary = "Adds :isolation_level option to ActiveRecord #transaction calls"
|
8
8
|
gem.description = "Adds :isolation_level option to ActiveRecord #transaction calls, as well as :minimum_isolation_level. Supports mysql and postgresql."
|
9
|
-
gem.has_rdoc = false
|
10
9
|
gem.author = "Will Bryant"
|
11
10
|
gem.email = "will.bryant@gmail.com"
|
12
11
|
gem.homepage = "http://github.com/willbryant/transaction_isolation_level"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transaction_isolation_level
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Will Bryant
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -60,6 +60,7 @@ extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
62
|
- ".gitignore"
|
63
|
+
- ".travis.yml"
|
63
64
|
- Gemfile
|
64
65
|
- MIT-LICENSE
|
65
66
|
- Rakefile
|
@@ -74,7 +75,7 @@ files:
|
|
74
75
|
homepage: http://github.com/willbryant/transaction_isolation_level
|
75
76
|
licenses: []
|
76
77
|
metadata: {}
|
77
|
-
post_install_message:
|
78
|
+
post_install_message:
|
78
79
|
rdoc_options: []
|
79
80
|
require_paths:
|
80
81
|
- lib
|
@@ -89,9 +90,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
90
|
- !ruby/object:Gem::Version
|
90
91
|
version: '0'
|
91
92
|
requirements: []
|
92
|
-
|
93
|
-
|
94
|
-
signing_key:
|
93
|
+
rubygems_version: 3.0.3
|
94
|
+
signing_key:
|
95
95
|
specification_version: 4
|
96
96
|
summary: 'Adds :isolation_level option to ActiveRecord #transaction calls'
|
97
97
|
test_files:
|