activerecord-cte 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test-with-mysql.yml +10 -1
- data/.github/workflows/test-with-postgresql.yml +12 -2
- data/.github/workflows/test-with-sqlite.yml +7 -3
- data/.ruby-version +1 -1
- data/Dockerfile +1 -1
- data/Gemfile +1 -1
- data/bin/test +1 -1
- data/lib/activerecord/cte/core_ext.rb +18 -3
- data/lib/activerecord/cte/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fec64d2dc3623acd9cfb623957035c94ce160ac7f1f5bc8df2777d37e8e496b6
|
4
|
+
data.tar.gz: 12d66f36eb856b43a5e23568234884b81db258a67bbed86417e2f28d90449dce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28a0be826ae1b0914f8fa4b9e7dd7d9f0221b67b453abfa9f680f943453f12a9436d756378059aade81e4341e352598309dc799441e063d8215c846a00df6ec0
|
7
|
+
data.tar.gz: 78839e99683a7ee08bae702361010986678e1f8a8eaa95e2508edf75188d359a6b3d3295630e4d2a7fb367214dc15d17df69c14a1b8d0d3970f2a5d3a35d49e7
|
@@ -6,7 +6,15 @@ jobs:
|
|
6
6
|
strategy:
|
7
7
|
fail-fast: false
|
8
8
|
matrix:
|
9
|
-
active_record: [6.1.
|
9
|
+
active_record: [6.1.7.2, 6.0.6, 5.2.8.1]
|
10
|
+
ruby: [2.6, 2.7, '3.0', 3.1, 3.2]
|
11
|
+
exclude:
|
12
|
+
- active_record: 5.2.8.1
|
13
|
+
ruby: '3.0'
|
14
|
+
- active_record: 5.2.8.1
|
15
|
+
ruby: 3.1
|
16
|
+
- active_record: 5.2.8.1
|
17
|
+
ruby: 3.2
|
10
18
|
env:
|
11
19
|
ACTIVE_RECORD_VERSION: ${{ matrix.active_record }}
|
12
20
|
DATABASE_ADAPTER: mysql
|
@@ -20,6 +28,7 @@ jobs:
|
|
20
28
|
- name: Set up Ruby
|
21
29
|
uses: ruby/setup-ruby@v1
|
22
30
|
with:
|
31
|
+
ruby-version: ${{ matrix.ruby }}
|
23
32
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
24
33
|
- name: Run tests
|
25
34
|
run: bundle exec rake test
|
@@ -3,11 +3,19 @@ on: [pull_request]
|
|
3
3
|
jobs:
|
4
4
|
Test-With-PostgreSQL:
|
5
5
|
runs-on: ubuntu-latest
|
6
|
-
container: ruby
|
6
|
+
container: ruby:${{ matrix.ruby }}
|
7
7
|
strategy:
|
8
8
|
fail-fast: false
|
9
9
|
matrix:
|
10
|
-
active_record: [6.1.
|
10
|
+
active_record: [6.1.7.2, 6.0.6, 5.2.8.1]
|
11
|
+
ruby: [2.6, 2.7, '3.0', 3.1, 3.2]
|
12
|
+
exclude:
|
13
|
+
- active_record: 5.2.8.1
|
14
|
+
ruby: '3.0'
|
15
|
+
- active_record: 5.2.8.1
|
16
|
+
ruby: 3.1
|
17
|
+
- active_record: 5.2.8.1
|
18
|
+
ruby: 3.2
|
11
19
|
env:
|
12
20
|
ACTIVE_RECORD_VERSION: ${{ matrix.active_record }}
|
13
21
|
DATABASE_ADAPTER: postgresql
|
@@ -28,6 +36,8 @@ jobs:
|
|
28
36
|
steps:
|
29
37
|
- name: Check out repository code
|
30
38
|
uses: actions/checkout@v2
|
39
|
+
- name: Update bundler
|
40
|
+
run: gem update bundler # Use the latest bundler
|
31
41
|
- name: Bundle dependencies
|
32
42
|
run: bundle install
|
33
43
|
- name: Run tests
|
@@ -6,12 +6,16 @@ jobs:
|
|
6
6
|
strategy:
|
7
7
|
fail-fast: false
|
8
8
|
matrix:
|
9
|
-
active_record: [6.1.
|
9
|
+
active_record: [6.1.7.2, 6.0.6, 5.2.8.1]
|
10
10
|
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
|
11
|
-
ruby: [2.6, 2.7, '3.0']
|
11
|
+
ruby: [2.6, 2.7, '3.0', 3.1, 3.2]
|
12
12
|
exclude:
|
13
|
-
- active_record: 5.2.
|
13
|
+
- active_record: 5.2.8.1
|
14
14
|
ruby: '3.0'
|
15
|
+
- active_record: 5.2.8.1
|
16
|
+
ruby: 3.1
|
17
|
+
- active_record: 5.2.8.1
|
18
|
+
ruby: 3.2
|
15
19
|
|
16
20
|
env:
|
17
21
|
ACTIVE_RECORD_VERSION: ${{ matrix.active_record }}
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.1.2
|
data/Dockerfile
CHANGED
data/Gemfile
CHANGED
@@ -5,7 +5,7 @@ source "https://rubygems.org"
|
|
5
5
|
# Specify your gem's dependencies in activerecord-cte.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
ACTIVE_RECORD_VERSION = ENV.fetch("ACTIVE_RECORD_VERSION", "6.1.
|
8
|
+
ACTIVE_RECORD_VERSION = ENV.fetch("ACTIVE_RECORD_VERSION", "6.1.7.2")
|
9
9
|
|
10
10
|
gem "activerecord", ACTIVE_RECORD_VERSION
|
11
11
|
|
data/bin/test
CHANGED
@@ -15,6 +15,7 @@ module ActiveRecord
|
|
15
15
|
private
|
16
16
|
|
17
17
|
def merge_withs
|
18
|
+
relation.recursive_with = true if other.recursive_with?
|
18
19
|
other_values = other.with_values.reject { |value| relation.with_values.include?(value) }
|
19
20
|
relation.with!(*other_values) if other_values.any?
|
20
21
|
end
|
@@ -30,7 +31,12 @@ module ActiveRecord
|
|
30
31
|
end
|
31
32
|
|
32
33
|
def with!(opts, *rest)
|
33
|
-
|
34
|
+
if opts == :recursive
|
35
|
+
self.recursive_with = true
|
36
|
+
self.with_values += rest
|
37
|
+
else
|
38
|
+
self.with_values += [opts] + rest
|
39
|
+
end
|
34
40
|
self
|
35
41
|
end
|
36
42
|
|
@@ -44,6 +50,16 @@ module ActiveRecord
|
|
44
50
|
@values[:with] = values
|
45
51
|
end
|
46
52
|
|
53
|
+
def recursive_with?
|
54
|
+
@values[:recursive_with]
|
55
|
+
end
|
56
|
+
|
57
|
+
def recursive_with=(value)
|
58
|
+
raise ImmutableRelation if @loaded
|
59
|
+
|
60
|
+
@values[:recursive_with] = value
|
61
|
+
end
|
62
|
+
|
47
63
|
private
|
48
64
|
|
49
65
|
def build_arel(*args)
|
@@ -55,7 +71,6 @@ module ActiveRecord
|
|
55
71
|
def build_with(arel) # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity
|
56
72
|
return if with_values.empty?
|
57
73
|
|
58
|
-
recursive = with_values.delete(:recursive)
|
59
74
|
with_statements = with_values.map do |with_value|
|
60
75
|
case with_value
|
61
76
|
when String then Arel::Nodes::SqlLiteral.new(with_value)
|
@@ -67,7 +82,7 @@ module ActiveRecord
|
|
67
82
|
end
|
68
83
|
end
|
69
84
|
|
70
|
-
|
85
|
+
recursive_with? ? arel.with(:recursive, with_statements) : arel.with(with_statements)
|
71
86
|
end
|
72
87
|
|
73
88
|
def build_with_value_from_array(array)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-cte
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vlado Cingel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -189,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
189
|
- !ruby/object:Gem::Version
|
190
190
|
version: '0'
|
191
191
|
requirements: []
|
192
|
-
rubygems_version: 3.
|
192
|
+
rubygems_version: 3.3.11
|
193
193
|
signing_key:
|
194
194
|
specification_version: 4
|
195
195
|
summary: Brings Common Table Expressions support to ActiveRecord and makes it super
|