activerecord-refined 0.3.3 → 0.5.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/sandbox.yml +158 -0
- data/.github/workflows/test.yml +56 -2
- data/LICENSE.txt +2 -1
- data/README.md +263 -17
- data/activerecord-refined.gemspec +3 -1
- data/benchmark/query_building.rb +129 -0
- data/examples/complex_joins.rb +14 -1
- data/examples/ctes.rb +82 -0
- data/examples/expressions.rb +87 -0
- data/examples/postgresql.rb +105 -0
- data/examples/predicates.rb +93 -0
- data/examples/subqueries.rb +67 -0
- data/lib/active_record/refined/ast.rb +320 -33
- data/lib/active_record/refined.rb +180 -20
- data/lib/activerecord-refined/version.rb +1 -1
- data/test/test_block_syntax.rb +597 -20
- data/test/test_helper.rb +12 -0
- metadata +8 -1
data/test/test_helper.rb
CHANGED
|
@@ -66,6 +66,12 @@ module SqlAssertions
|
|
|
66
66
|
skip "#{ADAPTER} has no array columns" unless ADAPTER == 'postgresql'
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
+
# MySQL has no NULLS FIRST/LAST; Arel emulates it with a leading IS NULL
|
|
70
|
+
# ordering, so only the resulting order is portable, not the SQL.
|
|
71
|
+
def skip_without_nulls_ordering_syntax
|
|
72
|
+
skip "#{ADAPTER} emulates NULLS FIRST/LAST" if ADAPTER == 'mysql2'
|
|
73
|
+
end
|
|
74
|
+
|
|
69
75
|
def regexp_operator
|
|
70
76
|
Regexp.escape(REGEXP_OPERATORS.fetch(ADAPTER).first)
|
|
71
77
|
end
|
|
@@ -104,11 +110,16 @@ class Post < ActiveRecord::Base
|
|
|
104
110
|
belongs_to :author
|
|
105
111
|
end
|
|
106
112
|
|
|
113
|
+
# Self-referencing, for the recursive CTE tests.
|
|
114
|
+
class Node < ActiveRecord::Base
|
|
115
|
+
end
|
|
116
|
+
|
|
107
117
|
class CreateAllTables < ActiveRecord::Migration[8.1]
|
|
108
118
|
def up
|
|
109
119
|
drop_table(:users, if_exists: true)
|
|
110
120
|
drop_table(:authors, if_exists: true)
|
|
111
121
|
drop_table(:posts, if_exists: true)
|
|
122
|
+
drop_table(:nodes, if_exists: true)
|
|
112
123
|
create_table(:users) do |t|
|
|
113
124
|
t.string :name
|
|
114
125
|
t.integer :age
|
|
@@ -116,6 +127,7 @@ class CreateAllTables < ActiveRecord::Migration[8.1]
|
|
|
116
127
|
end
|
|
117
128
|
create_table(:authors) {|t| t.string :name}
|
|
118
129
|
create_table(:posts) {|t| t.string :title; t.integer :author_id}
|
|
130
|
+
create_table(:nodes) {|t| t.string :name; t.integer :parent_id}
|
|
119
131
|
end
|
|
120
132
|
end
|
|
121
133
|
ActiveRecord::Migration.verbose = false
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activerecord-refined
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shugo Maeda
|
|
@@ -81,6 +81,7 @@ extensions: []
|
|
|
81
81
|
extra_rdoc_files: []
|
|
82
82
|
files:
|
|
83
83
|
- .github/workflows/push_gem.yml
|
|
84
|
+
- .github/workflows/sandbox.yml
|
|
84
85
|
- .github/workflows/test.yml
|
|
85
86
|
- .gitignore
|
|
86
87
|
- Gemfile
|
|
@@ -88,8 +89,14 @@ files:
|
|
|
88
89
|
- README.md
|
|
89
90
|
- Rakefile
|
|
90
91
|
- activerecord-refined.gemspec
|
|
92
|
+
- benchmark/query_building.rb
|
|
91
93
|
- examples/aggregations.rb
|
|
92
94
|
- examples/complex_joins.rb
|
|
95
|
+
- examples/ctes.rb
|
|
96
|
+
- examples/expressions.rb
|
|
97
|
+
- examples/postgresql.rb
|
|
98
|
+
- examples/predicates.rb
|
|
99
|
+
- examples/subqueries.rb
|
|
93
100
|
- lib/active_record/refined.rb
|
|
94
101
|
- lib/active_record/refined/ast.rb
|
|
95
102
|
- lib/activerecord-refined.rb
|