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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa6017d175139cbb92a4428130dc7ca14c10018a9a32d9c3dba0a6b68e41e348
4
- data.tar.gz: 139a0430c0f9732e36de816475d9c3d8fc12bd326ef1349401549193112652f2
3
+ metadata.gz: 24b0c6a6425bfa8f8b7137d7f3a96b84aa97c10f4d00b25c5a091890fef2de73
4
+ data.tar.gz: d6856b61cf2e747807af2baf843a41c3e667832a97183ff3db3867486c8e9d90
5
5
  SHA512:
6
- metadata.gz: '095fb61691550d6b95064d6d64e821759fd57d820f065eef9785284329bc8edceb69f8a29e244a25258851acc540bbc99446823f2309f4a1f2e6d8454cde779d'
7
- data.tar.gz: 308d0fe1766731ff4977783249d12a0ac9f845321124b4db793ef5ed13c00585af36afa4958e7ee5fe57d7175ac5d481f1a822fe0151552a9a9856050712ad10
6
+ metadata.gz: 0c68905f134a9d8c4e52a21aa1ab278b4de60b00fc93d2acd6935f0a65d8699fa76f543e03f6d9885d1fb148bdd48f9d072d9c66a12d7cb988e158068cb678ed
7
+ data.tar.gz: 0c999b62136a17857046eeb384a9fc8090e9cf70d8e7fa06febdd663169994ce348c657cc414795e5f47fc73fb7325d6903e3f5ed202c124d2d832b8bed45b70
@@ -6,7 +6,7 @@ jobs:
6
6
  strategy:
7
7
  fail-fast: false
8
8
  matrix:
9
- active_record: [6.1.4, 6.0.4, 5.2.6]
9
+ active_record: [6.1.4, 6.0.4]
10
10
  env:
11
11
  ACTIVE_RECORD_VERSION: ${{ matrix.active_record }}
12
12
  DATABASE_ADAPTER: mysql
@@ -3,11 +3,11 @@ on: [pull_request]
3
3
  jobs:
4
4
  Test-With-PostgreSQL:
5
5
  runs-on: ubuntu-latest
6
- container: ruby:2.7
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, 5.2.6]
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
- 2.7.3
1
+ 3.0.2
data/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM ruby:2.7
1
+ FROM ruby:3.0
2
2
 
3
3
  ENV APP_HOME /activerecord_cte
4
4
  RUN mkdir $APP_HOME
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.0.4")
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
  ![PostgreSQL](https://github.com/vlado/activerecord-cte/actions/workflows/test-with-postgresql.yml/badge.svg)
6
6
  ![SQLite](https://github.com/vlado/activerecord-cte/actions/workflows/test-with-sqlite.yml/badge.svg)
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 activerecord")
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 activerecord")
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"
@@ -46,7 +46,7 @@ module ActiveRecord
46
46
 
47
47
  private
48
48
 
49
- def build_arel(*args, **kwargs)
49
+ def build_arel(*args)
50
50
  arel = super
51
51
  build_with(arel) if @values[:with]
52
52
  arel
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Activerecord
4
4
  module Cte
5
- VERSION = "0.1.5"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
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.1.5
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-02 00:00:00.000000000 Z
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.1.6
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