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: 971a68fa07394767b18c8781df8be28eada7a1024256698f63bc4c0b0c06a560
4
- data.tar.gz: 266f91ca87e1da40a0fbd13a9cde183e167c2950f1d0718169fdb8e4ff4eec52
3
+ metadata.gz: '05957cccec4b1ee5138e9e74daa7714da41b99be958f7171e1c88475fe495e7b'
4
+ data.tar.gz: fd7cb71f07ded6599286dac27c274832bf97de43e56b69a47b7238aefaac2cde
5
5
  SHA512:
6
- metadata.gz: f4f5ca51ab18b44f7a832d9442c7412e725c6b4d688fd481d45752168a6fb6665b15cf288934399d0eb7ef64e8a78a44730fa138cb0f1ff0e1435c135a8b627e
7
- data.tar.gz: 223b0432f2198a98f33dfeba24f156938b47d286908a62571f93b7acfebeef6fc5594f0eac8c47805e01c1038c25af6af68321e0e829d4f673b5a5292587eede
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DynamicMigrations
4
- VERSION = "3.1.1"
4
+ VERSION = "3.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamic_migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig Ulliott