dynamic_migrations 3.8.0 → 3.8.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1235cefb0bc31fd54a095fbef1111be30cb13f89bb6c4358364f35594ffe95ff
|
4
|
+
data.tar.gz: e9050d22292034176525471025a8981fba83c8945b8a81f754c3c2a222cc4538
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2be636e7faf4eb9d05d8f6fb507603aa362f341982a44f99e7e35dd365481fe7042b04e1dcd743981ea321082af61be38e8a1b73c31109e09252f3736c51afb3
|
7
|
+
data.tar.gz: 9db574a68a9009bee00bb5e8d16604b577e0d33a999ece3df62144516a15ba8f0187e624346ab87913f3c04805de4140eb0dd5b68c5d0f1fd30dff7010efef97
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [3.8.1](https://github.com/craigulliott/dynamic_migrations/compare/v3.8.0...v3.8.1) (2023-10-06)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* reusing exiting connection when with_connection is called (it was trying to open a new connection and caused an error) ([840a5cd](https://github.com/craigulliott/dynamic_migrations/commit/840a5cda04d6bc49d73160d2bad7271780027c84))
|
9
|
+
|
3
10
|
## [3.8.0](https://github.com/craigulliott/dynamic_migrations/compare/v3.7.0...v3.8.0) (2023-10-04)
|
4
11
|
|
5
12
|
|
@@ -33,19 +33,31 @@ module DynamicMigrations
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
def connected?
|
37
|
+
!@connection.nil?
|
38
|
+
end
|
39
|
+
|
36
40
|
# Opens a connection to the database server, and yields the provided block
|
37
41
|
# before automatically closing the connection again. This is useful for
|
38
42
|
# executing one time queries against the database server.
|
39
43
|
def with_connection &block
|
40
|
-
# create a temporary connection to the server
|
41
|
-
|
44
|
+
# create a temporary connection to the server (unless we are already connected)
|
45
|
+
already_connected = connected?
|
46
|
+
unless already_connected
|
47
|
+
connect
|
48
|
+
end
|
49
|
+
|
42
50
|
# perform work with the connection
|
43
51
|
# todo: `yield connection` would have been preferred, but rbs/steep doesnt understand that syntax
|
44
52
|
if block.is_a? Proc
|
45
53
|
result = block.call connection
|
46
54
|
end
|
47
|
-
|
48
|
-
|
55
|
+
|
56
|
+
# close the connection (unless we were already connected)
|
57
|
+
if already_connected
|
58
|
+
disconnect
|
59
|
+
end
|
60
|
+
|
49
61
|
# return whever was returned from within the block
|
50
62
|
result
|
51
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynamic_migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.8.
|
4
|
+
version: 3.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Craig Ulliott
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|