activerecord-cte 0.1.5 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test-with-mysql.yml +1 -1
- data/.github/workflows/test-with-postgresql.yml +2 -2
- data/.github/workflows/test-with-sqlite.yml +7 -0
- data/.ruby-version +1 -1
- data/Dockerfile +1 -1
- data/Gemfile +1 -1
- data/README.md +3 -1
- data/bin/test +4 -12
- data/lib/activerecord/cte/core_ext.rb +1 -1
- data/lib/activerecord/cte/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24b0c6a6425bfa8f8b7137d7f3a96b84aa97c10f4d00b25c5a091890fef2de73
|
4
|
+
data.tar.gz: d6856b61cf2e747807af2baf843a41c3e667832a97183ff3db3867486c8e9d90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c68905f134a9d8c4e52a21aa1ab278b4de60b00fc93d2acd6935f0a65d8699fa76f543e03f6d9885d1fb148bdd48f9d072d9c66a12d7cb988e158068cb678ed
|
7
|
+
data.tar.gz: 0c999b62136a17857046eeb384a9fc8090e9cf70d8e7fa06febdd663169994ce348c657cc414795e5f47fc73fb7325d6903e3f5ed202c124d2d832b8bed45b70
|
@@ -3,11 +3,11 @@ on: [pull_request]
|
|
3
3
|
jobs:
|
4
4
|
Test-With-PostgreSQL:
|
5
5
|
runs-on: ubuntu-latest
|
6
|
-
container: ruby:
|
6
|
+
container: ruby:3.0
|
7
7
|
strategy:
|
8
8
|
fail-fast: false
|
9
9
|
matrix:
|
10
|
-
active_record: [6.1.4, 6.0.4
|
10
|
+
active_record: [6.1.4, 6.0.4]
|
11
11
|
env:
|
12
12
|
ACTIVE_RECORD_VERSION: ${{ matrix.active_record }}
|
13
13
|
DATABASE_ADAPTER: postgresql
|
@@ -7,6 +7,12 @@ jobs:
|
|
7
7
|
fail-fast: false
|
8
8
|
matrix:
|
9
9
|
active_record: [6.1.4, 6.0.4, 5.2.6]
|
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']
|
12
|
+
exclude:
|
13
|
+
- active_record: 5.2.6
|
14
|
+
ruby: '3.0'
|
15
|
+
|
10
16
|
env:
|
11
17
|
ACTIVE_RECORD_VERSION: ${{ matrix.active_record }}
|
12
18
|
DATABASE_ADAPTER: sqlite3
|
@@ -17,6 +23,7 @@ jobs:
|
|
17
23
|
- name: Set up Ruby
|
18
24
|
uses: ruby/setup-ruby@v1
|
19
25
|
with:
|
26
|
+
ruby-version: ${{ matrix.ruby }}
|
20
27
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
21
28
|
- name: Run tests
|
22
29
|
run: bundle exec rake test
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.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.
|
8
|
+
ACTIVE_RECORD_VERSION = ENV.fetch("ACTIVE_RECORD_VERSION", "6.1.4")
|
9
9
|
|
10
10
|
gem "activerecord", ACTIVE_RECORD_VERSION
|
11
11
|
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|

|
6
6
|

|
7
7
|
|
8
|
-
Adds Common Table Expression support to ActiveRecord (Rails).
|
8
|
+
Adds [Common Table Expression](https://en.wikipedia.org/wiki/Hierarchical_and_recursive_queries_in_SQL#Common_table_expression) support to ActiveRecord (Rails).
|
9
9
|
|
10
10
|
It adds `.with` query method and makes it super easy to build and chain complex CTE queries. Let's explain it using simple example.
|
11
11
|
|
@@ -27,6 +27,8 @@ WITH posts_with_comments AS (
|
|
27
27
|
SELECT * FROM posts
|
28
28
|
```
|
29
29
|
|
30
|
+
**Please note that this creates the expressions but is not using them yet. See [Taking it further](#taking-it-further) for more info.**
|
31
|
+
|
30
32
|
Without this gem you would need to use `Arel` directly.
|
31
33
|
|
32
34
|
```ruby
|
data/bin/test
CHANGED
@@ -4,16 +4,8 @@
|
|
4
4
|
require "English"
|
5
5
|
require "yaml"
|
6
6
|
|
7
|
-
active_record_versions = []
|
8
|
-
database_adapters = []
|
9
|
-
|
10
|
-
# Extract ActiveRecord versions and database adapters from CI workflows
|
11
|
-
Dir[".github/workflows/test-**.yml"].each do |path|
|
12
|
-
yml = YAML.load_file(path)
|
13
|
-
job = yml["jobs"].values.first
|
14
|
-
active_record_versions << job["strategy"]["matrix"]["active_record"]
|
15
|
-
database_adapters << job["env"]["DATABASE_ADAPTER"]
|
16
|
-
end
|
7
|
+
active_record_versions = %w[6.1.4 6.0.4]
|
8
|
+
database_adapters = %w[mysql postgresql sqlite3]
|
17
9
|
|
18
10
|
class Matrix
|
19
11
|
def initialize(active_record_versions, database_adapters)
|
@@ -28,7 +20,7 @@ class Matrix
|
|
28
20
|
run_with_active_record_version(ar_version)
|
29
21
|
end
|
30
22
|
puts "----> Reverting back to original ActiveRecord version (#{original_ar_version})"
|
31
|
-
cmd("ACTIVE_RECORD_VERSION=#{original_ar_version} bundle update
|
23
|
+
cmd("ACTIVE_RECORD_VERSION=#{original_ar_version} bundle update")
|
32
24
|
|
33
25
|
exit(@exit_status_code) unless @exit_status_code.zero?
|
34
26
|
end
|
@@ -42,7 +34,7 @@ class Matrix
|
|
42
34
|
|
43
35
|
def run_with_active_record_version(ar_version)
|
44
36
|
puts "----> Switching ActiveRecord to version #{ar_version}"
|
45
|
-
cmd("ACTIVE_RECORD_VERSION=#{ar_version} bundle update
|
37
|
+
cmd("ACTIVE_RECORD_VERSION=#{ar_version} bundle update")
|
46
38
|
|
47
39
|
@database_adapters.each do |adapter|
|
48
40
|
puts "----> Running tests with ActiveRecord #{ar_version} and #{adapter} adapter"
|
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.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vlado Cingel
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -174,7 +174,7 @@ metadata:
|
|
174
174
|
allowed_push_host: https://rubygems.org
|
175
175
|
homepage_uri: https://github.com/vlado/activerecord-cte
|
176
176
|
source_code_uri: https://github.com/vlado/activerecord-cte
|
177
|
-
post_install_message:
|
177
|
+
post_install_message:
|
178
178
|
rdoc_options: []
|
179
179
|
require_paths:
|
180
180
|
- lib
|
@@ -189,8 +189,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
189
|
- !ruby/object:Gem::Version
|
190
190
|
version: '0'
|
191
191
|
requirements: []
|
192
|
-
rubygems_version: 3.
|
193
|
-
signing_key:
|
192
|
+
rubygems_version: 3.2.22
|
193
|
+
signing_key:
|
194
194
|
specification_version: 4
|
195
195
|
summary: Brings Common Table Expressions support to ActiveRecord and makes it super
|
196
196
|
easy to build and chain complex CTE queries
|