sequel-activerecord_connection 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e7023579a13396cf034b357786ebf56c98c15a09693ffe97900c86b221cc596
4
- data.tar.gz: ff4b9033f260499e70a7f82ee901a77a8e370b230e968072c04d9ae5d4226029
3
+ metadata.gz: 94acb3799fdbf874ddad7c419bba8e39c75e09a4e59c724e28a69249fe434e35
4
+ data.tar.gz: 1ad5e5b556427804e682dc6948626c557a89e62030ad8b9ee2827905dea245fe
5
5
  SHA512:
6
- metadata.gz: ac0955585457b396ffe074ddb6c040adba15b42052d1c1649635c85223b7cee86e11986b639cbe2a868048ab6926d410f5564210ef745101aa880d591242c57d
7
- data.tar.gz: 459fd7c8b13036b93afe8dfd9a63af1137997ad04fd8e340a9a218c31196ff319dc29861647bfffd9e9a338a21a3cacb88439d04e45fff09f5fa81765167025f
6
+ metadata.gz: 876b0d32959a6263e2e6ac7309bdab3833fd07e0778ec1b5437abd8a61417b32fe7034e8473c916accae59e34f2bb64ce3e875a180d0abadfccc6c5725a98a51
7
+ data.tar.gz: b32f9486f8a3452e5c99fd5aa28dfdb6322a788267dc4307c76a8d2d01b83070de62aed105c91b41d3620a112d36d630dd114e383330bb0701430a167f32d901
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.4.0 (2024-03-19)
2
+
3
+ * Only warn when Sequel extension fails to initialize because there is no database (@janko)
4
+
5
+ * Drop support for Active Record 4.2 (@janko)
6
+
1
7
  ## 1.3.1 (2023-04-22)
2
8
 
3
9
  * Fix Active Record's query cache not being cleared in SQLite adapter (@janko)
data/README.md CHANGED
@@ -8,8 +8,8 @@ This can be useful if you want to use a library that uses Sequel (e.g.
8
8
  or if you just want to use Sequel for more complex queries, and you want to
9
9
  avoid creating new database connections.
10
10
 
11
- It works on ActiveRecord 4.2+ and fully supports PostgresSQL, MySQL and SQLite
12
- adapters, both native and JDBC (JRuby). The [SQL Server] external adapter is
11
+ It works on ActiveRecord 4.2+ and fully supports PostgresSQL, MySQL and SQLite,
12
+ both the native adapters and JDBC (JRuby). The [SQL Server] external adapter is
13
13
  supported as well (`tinytds` in Sequel), and there is attempted support for
14
14
  [Oracle enhanced] (`oracle` and in Sequel). Other adapters might work too, but
15
15
  their integration hasn't been tested.
@@ -32,6 +32,12 @@ module Sequel
32
32
  raise Error, "creating a Sequel connection is not allowed"
33
33
  end
34
34
 
35
+ def extension(*)
36
+ super
37
+ rescue ActiveRecord::NoDatabaseError
38
+ warn "Sequel database extension #{@loaded_extensions.last.inspect} failed to initialize because there is no database."
39
+ end
40
+
35
41
  # Avoid calling Sequel's connection pool, instead use Active Record's.
36
42
  def synchronize(*)
37
43
  activerecord_lock do
@@ -43,6 +49,8 @@ module Sequel
43
49
 
44
50
  yield conn
45
51
  end
52
+ ensure
53
+ clear_activerecord_query_cache
46
54
  end
47
55
 
48
56
  # Log executed queries into Active Record logger as well.
@@ -57,17 +65,6 @@ module Sequel
57
65
  @timezone || activerecord_timezone
58
66
  end
59
67
 
60
- # Clear Active Record's query cache after potential data modifications.
61
- %i[execute_ddl execute_dui execute_insert execute].each do |execute_method|
62
- define_method(execute_method) do |*args, &block|
63
- begin
64
- super(*args, &block)
65
- ensure
66
- clear_activerecord_query_cache
67
- end
68
- end
69
- end
70
-
71
68
  private
72
69
 
73
70
  # Synchronizes transaction state with ActiveRecord. Sequel uses this
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "sequel-activerecord_connection"
3
- spec.version = "1.3.1"
3
+ spec.version = "1.4.0"
4
4
  spec.authors = ["Janko Marohnić"]
5
5
  spec.email = ["janko.marohnic@gmail.com"]
6
6
 
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.required_ruby_version = ">= 2.4"
13
13
 
14
14
  spec.add_dependency "sequel", "~> 5.38"
15
- spec.add_dependency "activerecord", ">= 4.2", "< 8"
15
+ spec.add_dependency "activerecord", ">= 5.0", "< 8"
16
16
  spec.add_dependency "after_commit_everywhere", "~> 1.1"
17
17
 
18
18
  spec.add_development_dependency "sequel_pg" unless RUBY_ENGINE == "jruby"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-activerecord_connection
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-22 00:00:00.000000000 Z
11
+ date: 2024-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '4.2'
33
+ version: '5.0'
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
36
  version: '8'
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: '4.2'
43
+ version: '5.0'
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '8'
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0'
140
140
  requirements: []
141
- rubygems_version: 3.4.12
141
+ rubygems_version: 3.5.3
142
142
  signing_key:
143
143
  specification_version: 4
144
144
  summary: Allows Sequel to use ActiveRecord connection for database interaction.