dynamic_migrations 3.1.1 → 3.2.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '05957cccec4b1ee5138e9e74daa7714da41b99be958f7171e1c88475fe495e7b'
|
4
|
+
data.tar.gz: fd7cb71f07ded6599286dac27c274832bf97de43e56b69a47b7238aefaac2cde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1729685ce54c91e0a3a8ce03fbb552887450b843f4c654678717aba41c1e52b66dff1104b9acaedd955e221267619e64405fe4088af9de54b9216446bf87984
|
7
|
+
data.tar.gz: 95668080a1d329fcaf0172e3593cfc59bab34b7edca05fedfe23d10d7b83945bd9c79943768765f505997fdd8781721569b2845d752d8f99450d251758d41eac
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [3.2.0](https://github.com/craigulliott/dynamic_migrations/compare/v3.1.1...v3.2.0) (2023-08-16)
|
4
|
+
|
5
|
+
|
6
|
+
### Features
|
7
|
+
|
8
|
+
* adding a with_connection method to the database which yields to a block, and provides a connection object to that block ([fc1590a](https://github.com/craigulliott/dynamic_migrations/commit/fc1590a00be8d3f9f0ee0472a96be94b80e667e0))
|
9
|
+
|
3
10
|
## [3.1.1](https://github.com/craigulliott/dynamic_migrations/compare/v3.1.0...v3.1.1) (2023-08-16)
|
4
11
|
|
5
12
|
|
@@ -32,6 +32,21 @@ module DynamicMigrations
|
|
32
32
|
raise NotConnectedError
|
33
33
|
end
|
34
34
|
end
|
35
|
+
|
36
|
+
# Opens a connection to the database server, and yields the provided block
|
37
|
+
# before automatically closing the connection again. This is useful for
|
38
|
+
# executing one time queries against the database server.
|
39
|
+
def with_connection &block
|
40
|
+
# create a temporary connection to the server
|
41
|
+
connect
|
42
|
+
# perform work with the connection
|
43
|
+
# todo: `yield connection` would have been preferred, but rbs/steep doesnt understand that syntax
|
44
|
+
if block.is_a? Proc
|
45
|
+
block.call connection
|
46
|
+
end
|
47
|
+
# close the connection
|
48
|
+
disconnect
|
49
|
+
end
|
35
50
|
end
|
36
51
|
end
|
37
52
|
end
|