rom-sql 3.5.0 → 3.6.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: 72190a3c5b2df9cf0bc5db0ba2a4cae185f88e87dfa9ad7d0f7cf3967c1fe048
4
- data.tar.gz: acd353e5348e8c797275829dacfedb445289e5e76d636df4b5cb7b40c1f48e7b
3
+ metadata.gz: cc51c9abdc25fa792a3115391e4dbb169d8c7dba6bac5553810140013d097836
4
+ data.tar.gz: 9b96d61a4dbdb7fa422f66e04933f89c513e429d5576cb6ce5c3c41acec96649
5
5
  SHA512:
6
- metadata.gz: 93bc3e2cb1873865a886d221d34ff164a7d83de2ddaec4f6f3d99daf65465a14ded348c546151ae9d44e6eae6ca4dded468cc7386ff4513d6b02bab843485f14
7
- data.tar.gz: 6c45fd11d745c05d1f536700c1cb246dd358e09668a406377281486b3d062c366db847dea96e457170e518e104baf64bb296f41613dd0099b5ffb7e839cd7679
6
+ metadata.gz: 185d71f20d84f614f47511bd1f5f21fd03cfd5d6f0734431464cfa895bb5a1b263798becd891c26b54498c50970d73dcb43cda8c34b2a90a25ca5e164a3921e9
7
+ data.tar.gz: 57926f14bd364b7abbab21c5bb6d89a53989029e84540e88e9b3b4695abc60509d741884e52313e329f676cfb787ce53eeaf8519794672e75d60f66162bbfb9a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
2
2
 
3
+ ## 3.6.1 2022-11-22
4
+
5
+ ### Fixed
6
+
7
+ - Mapping of cidr types in PostgreSQL to IPAddr values (@flash-gordon)
8
+
9
+ ## 3.6.0 2022-11-11
10
+
11
+ ### Added
12
+
13
+ - Add ROM::SQL::RakeSupport.migration_options for passing custom options to migrator (@wuarmin)
14
+
15
+ ### Changed
16
+
17
+ - Upgraded to the latest versions of dry-rb dependencies, compatible with rom 5.3 (@flash-gordon)
18
+
19
+ [Compare v3.5.0...v3.6.0](https://github.com/rom-rb/rom-sql/compare/v3.5.0...v3.6.0)
20
+
3
21
  ## 3.5.0 2021-03-26
4
22
 
5
23
 
@@ -20,7 +20,7 @@ module ROM
20
20
  'jsonb' => Types::JSONB,
21
21
  'xml' => Types::XML,
22
22
  'inet' => Types::IPAddress,
23
- 'cidr' => Types::IPAddress,
23
+ 'cidr' => Types::IPNetwork,
24
24
  'macaddr' => SQL::Types::String,
25
25
  'point' => Types::Point,
26
26
  'hstore' => Types::HStore,
@@ -16,6 +16,7 @@ module ROM
16
16
  Types::JSONB => 'jsonb',
17
17
  Types::HStore => 'hstore',
18
18
  Types::IPAddress => 'inet',
19
+ Types::IPNetwork => 'cidr',
19
20
  Types::Point => 'point',
20
21
  Types::Line => 'line',
21
22
  Types::Circle => 'circle',
@@ -7,9 +7,22 @@ module ROM
7
7
  module Postgres
8
8
  module Types
9
9
  IPAddress = Type('inet') do
10
- read = SQL::Types.Constructor(IPAddr) { |ip| IPAddr.new(ip.to_s) }
10
+ read = SQL::Types.Constructor(IPAddr) { |ip| ::IPAddr.new(ip.to_s) }
11
11
 
12
- SQL::Types.Constructor(IPAddr, &:to_s).meta(read: read)
12
+ SQL::Types.Constructor(::IPAddr, &:to_s).meta(read: read)
13
+ end
14
+
15
+ IPNetwork = Type('cidr') do
16
+ read = SQL::Types.Constructor(IPAddr) do |ip|
17
+ case ip
18
+ when ::IPAddr
19
+ ip
20
+ when String
21
+ ::IPAddr.new(ip)
22
+ end
23
+ end
24
+
25
+ SQL::Types.Constructor(::IPAddr) { |ip| "#{ip}/#{ip.prefix}" }.meta(read: read)
13
26
  end
14
27
  end
15
28
  end
@@ -89,7 +89,12 @@ module ROM
89
89
 
90
90
  # @api private
91
91
  def new(&block)
92
- meta(func: ::Sequel::SQL::Function.new!(func.name, func.args.map(&block), func.opts))
92
+ case func
93
+ when ::Sequel::SQL::Function
94
+ meta(func: ::Sequel::SQL::Function.new!(func.name, func.args.map(&block), func.opts))
95
+ else
96
+ meta(func: func)
97
+ end
93
98
  end
94
99
 
95
100
  # @see Attribute#qualified?
@@ -10,7 +10,7 @@ module ROM
10
10
 
11
11
  class << self
12
12
  def run_migrations(options = {})
13
- gateway.run_migrations(options)
13
+ gateway.run_migrations(migration_options.merge(options))
14
14
  end
15
15
 
16
16
  def create_migration(*args)
@@ -24,6 +24,13 @@ module ROM
24
24
  # @api public
25
25
  attr_accessor :env
26
26
 
27
+
28
+ # Migration options, which are passed to `ROM::SQL::RakeSupport.run_migrations`. You can
29
+ # set them in the `db:setup` task with `ROM::SQL::RakeSupport.migration_options = { ... }`
30
+ #
31
+ # @api public
32
+ attr_accessor :migration_options
33
+
27
34
  private
28
35
 
29
36
  def gateway
@@ -40,6 +47,7 @@ module ROM
40
47
  end
41
48
 
42
49
  @env = nil
50
+ @migration_options = {}
43
51
  end
44
52
  end
45
53
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ROM
4
4
  module SQL
5
- VERSION = '3.5.0'.freeze
5
+ VERSION = '3.6.1'.freeze
6
6
  end
7
7
  end
data/lib/rom/sql.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/equalizer'
4
-
5
3
  require 'rom/core'
6
4
 
7
5
  require 'rom/sql/version'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rom-sql
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.0
4
+ version: 3.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-26 00:00:00.000000000 Z
11
+ date: 2022-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -44,20 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.5'
48
- - - ">="
49
- - !ruby/object:Gem::Version
50
- version: '0.5'
47
+ version: '1.0'
51
48
  type: :runtime
52
49
  prerelease: false
53
50
  version_requirements: !ruby/object:Gem::Requirement
54
51
  requirements:
55
52
  - - "~>"
56
53
  - !ruby/object:Gem::Version
57
- version: '0.5'
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: '0.5'
54
+ version: '1.0'
61
55
  - !ruby/object:Gem::Dependency
62
56
  name: rom
63
57
  requirement: !ruby/object:Gem::Requirement
@@ -234,14 +228,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
234
228
  requirements:
235
229
  - - ">="
236
230
  - !ruby/object:Gem::Version
237
- version: 2.4.0
231
+ version: 2.7.0
238
232
  required_rubygems_version: !ruby/object:Gem::Requirement
239
233
  requirements:
240
234
  - - ">="
241
235
  - !ruby/object:Gem::Version
242
236
  version: '0'
243
237
  requirements: []
244
- rubygems_version: 3.2.3
238
+ rubygems_version: 3.3.7
245
239
  signing_key:
246
240
  specification_version: 4
247
241
  summary: SQL databases support for ROM