rom-sql 3.0.1 → 3.1.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/CHANGELOG.md +252 -224
- data/LICENSE +20 -0
- data/README.md +3 -3
- data/lib/rom/sql/associations/core.rb +8 -0
- data/lib/rom/sql/attribute.rb +5 -15
- data/lib/rom/sql/attribute_aliasing.rb +60 -0
- data/lib/rom/sql/attribute_wrapping.rb +30 -0
- data/lib/rom/sql/extensions/postgres/types/array.rb +1 -2
- data/lib/rom/sql/extensions/postgres/types/json.rb +63 -8
- data/lib/rom/sql/function.rb +16 -0
- data/lib/rom/sql/gateway.rb +3 -0
- data/lib/rom/sql/mapper_compiler.rb +10 -1
- data/lib/rom/sql/plugin/nullify.rb +35 -0
- data/lib/rom/sql/plugins.rb +2 -0
- data/lib/rom/sql/relation/reading.rb +26 -2
- data/lib/rom/sql/type_extensions.rb +1 -3
- data/lib/rom/sql/version.rb +1 -1
- metadata +25 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f52d96de5f0817d048ca81908d0e1548fde8437314ce2842732fa0de1bc2a45
|
4
|
+
data.tar.gz: e194b0a48c85a5a4651dcc1ff073f34e256aad05d22ff8255d16c17418948acf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b9c43411663f8c89bc6df66df77afae600c1b053deb786b23aa7aabafcce6692b8265a11fe9431ea985cdff4d186d8d27cad7407729e2ddf8db8fc38dbb8d09
|
7
|
+
data.tar.gz: 9ccb96a9bf4d8d2a6dd638313317fd992e925b1ad5bd4447813e74f6ff2e4a916a10376f37e8982bb0ac09647299a412bbcd27be2f95966f7d28d27e23789559
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,33 @@
|
|
1
|
+
## 3.1.0 2019-12-16
|
2
|
+
|
3
|
+
### Added
|
4
|
+
|
5
|
+
- `.nullify` that turns the result set of any relation into an empty set. Analogue of `ActiveRecord#none` (@ianks + @flash-gordon)
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
# Don't forget to activate the plugin
|
9
|
+
conf.relation(:users) do
|
10
|
+
use :nullify
|
11
|
+
end
|
12
|
+
|
13
|
+
users.nullify.count # => will always be 0
|
14
|
+
users.nullify.to_a # => will always be empty ([])
|
15
|
+
```
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
|
19
|
+
- Make `Relation#wrap` respect association views (@ianks)
|
20
|
+
- Primitive JSON-compatible values such as Integer and String are automatically coerced to correct JSONB values and back if you're using a recent Sequel version (>= 5.2.0) (@flash-gordon)
|
21
|
+
- Properly qualify relations when in `Relation#union` (@ianks)
|
22
|
+
- `Relation#query` no longer removes order in the relation (@DNNX)
|
23
|
+
|
24
|
+
[Compare v3.0.1...v3.1.0](https://github.com/rom-rb/rom-sql/compare/v3.0.1...v3.1.0)
|
25
|
+
|
1
26
|
## 3.0.1 2019-05-05
|
2
27
|
|
3
28
|
### Fixed
|
4
29
|
|
5
|
-
|
30
|
+
- Using joins with a relation object as the target and a block-based conditions produces correct query now (issue #331) (solnic)
|
6
31
|
|
7
32
|
[Compare v3.0.0...v3.0.1](https://github.com/rom-rb/rom-sql/compare/v3.0.0...v3.0.1)
|
8
33
|
|
@@ -10,7 +35,7 @@
|
|
10
35
|
|
11
36
|
### Added
|
12
37
|
|
13
|
-
|
38
|
+
- Join DSL so that you can use arbitrary conditions when joining relations (flash-gordon)
|
14
39
|
```ruby
|
15
40
|
users.join(tasks) { |users:, tasks:|
|
16
41
|
tasks[:user_id].is(users[:id]) & users[:name].is('John')
|
@@ -24,7 +49,8 @@
|
|
24
49
|
users[:id].is(authors[:id])
|
25
50
|
}.select(:name)
|
26
51
|
```
|
27
|
-
|
52
|
+
- Support for `CASE` expression (wmaciejak + flash-gordon)
|
53
|
+
|
28
54
|
```ruby
|
29
55
|
# matching expression result
|
30
56
|
users.select_append { id.case(1 => string('one'), else: string('something else')).as(:one_or_else) }
|
@@ -32,31 +58,34 @@
|
|
32
58
|
# searching for `true` result
|
33
59
|
users.select_append { string::case(id.is(1) => 'one', else: 'else').as(:one_or_else) }
|
34
60
|
```
|
35
|
-
|
61
|
+
|
62
|
+
- Relations can be accessed in DSLs with keyword arguments (flash-gordon)
|
36
63
|
```ruby
|
37
64
|
users.join(posts).select_append { |posts: | posts[:title] }
|
38
65
|
```
|
39
|
-
|
66
|
+
- Support for `.exists` in the projection DSL (flash-gordon)
|
40
67
|
```ruby
|
41
68
|
users.select_append { |posts: |
|
42
69
|
exists(posts.where(posts[:user_id] => id)).as(:has_posts)
|
43
70
|
}
|
44
71
|
```
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
72
|
+
- `Relation#unfiltered` returns an unrestricted relation (removes restrictions from `WHERE` and `HAVING`) (flash-gordon)
|
73
|
+
- Support for `WITHIN GROUP` in the function DSL has been enhanced with block syntax (flash-gordon)
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
# previously available version
|
77
|
+
households.project { float::percentile_cont(0.5).within_group(income).as(:percentile) }
|
78
|
+
# using the new syntax
|
79
|
+
households.project { float::percentile_cont(0.5).within_group { income }.as(:percentile) }
|
80
|
+
```
|
81
|
+
|
82
|
+
- Support for migrator options ie `ROM::Configuration.new(:sql, migrator: { path: "my_migrations" })` (rawburt)
|
83
|
+
- `Relation#pluck` works with multiple args too (timriley)
|
55
84
|
|
56
85
|
### Changed
|
57
86
|
|
58
|
-
|
59
|
-
|
87
|
+
- [BREAKING] Updated to work with `dry-types 1.0.0` (flash-gordon)
|
88
|
+
- [BREAKING] `Types::Int` is now `Types::Integer` (GustavoCaso)
|
60
89
|
|
61
90
|
### Fixed
|
62
91
|
|
@@ -69,7 +98,7 @@
|
|
69
98
|
|
70
99
|
### Added
|
71
100
|
|
72
|
-
|
101
|
+
- Support for subqueries in `SELECT` and `WHERE` :tada: (flash-gordon)
|
73
102
|
```ruby
|
74
103
|
tasks = relations[:tasks]
|
75
104
|
users = relations[:users]
|
@@ -84,8 +113,8 @@
|
|
84
113
|
|
85
114
|
### Added
|
86
115
|
|
87
|
-
|
88
|
-
|
116
|
+
- Support for functions with `Any` return type (GustavoCaso)
|
117
|
+
- New `Relation#as_hash` method (GustavoCaso)
|
89
118
|
|
90
119
|
[Compare v2.3.0...v2.4.0](https://github.com/rom-rb/rom-sql/compare/v2.3.0...v2.4.0)
|
91
120
|
|
@@ -93,18 +122,18 @@
|
|
93
122
|
|
94
123
|
### Added
|
95
124
|
|
96
|
-
|
97
|
-
|
125
|
+
- Command's `:timestamp` plugin now supports passing options (GustavoCaso)
|
126
|
+
- Configuration supports hash with connection options (Kjarrigan + solnic)
|
98
127
|
|
99
128
|
### Fixed
|
100
129
|
|
101
|
-
|
102
|
-
|
130
|
+
- Aliased attributes are handled correctly in PG's commands (cflipse)
|
131
|
+
- Command extensions are properly applied in multi-adapter setups (solnic)
|
103
132
|
|
104
133
|
### Internal
|
105
134
|
|
106
|
-
|
107
|
-
|
135
|
+
- Custom SQL-specific mapper compiler was added, which is used starting from rom-core 4.1.0 (solnic)
|
136
|
+
- Command's `:timestamp` plugin was removed, as it was moved to rom-core (GustavoCaso)
|
108
137
|
|
109
138
|
[Compare v2.2.1...v2.3.0](https://github.com/rom-rb/rom-sql/compare/v2.2.1...v2.3.0)
|
110
139
|
|
@@ -112,8 +141,8 @@
|
|
112
141
|
|
113
142
|
### Fixed
|
114
143
|
|
115
|
-
|
116
|
-
|
144
|
+
- Instrumentation works with all db interactions (not just queries that materialize relations) (solnic)
|
145
|
+
- Typo in `MissingEnv` exception message (romatr)
|
117
146
|
|
118
147
|
[Compare v2.2.0...v2.2.1](https://github.com/rom-rb/rom-sql/compare/v2.2.0...v2.2.1)
|
119
148
|
|
@@ -121,14 +150,14 @@
|
|
121
150
|
|
122
151
|
### Added
|
123
152
|
|
124
|
-
|
125
|
-
|
126
|
-
|
153
|
+
- Relation registry is passed as an argument to DSL blocks (in `select`, `where`, `order` etc.), which enables syntax like `select { |r| [id, r.tasks[:title]] }` (solnic)
|
154
|
+
- Support for self-referenced many-to-many associations (solnic)
|
155
|
+
- PG's geometric types include meta data about db types (GustavoCaso)
|
127
156
|
|
128
157
|
### Fixed
|
129
158
|
|
130
|
-
|
131
|
-
|
159
|
+
- Custom schema is used correctly in command results (solnic)
|
160
|
+
- Schemas no longer finalize PKs (this is done in core schema already) (solnic)
|
132
161
|
|
133
162
|
[Compare v2.1.0...v2.2.0](https://github.com/rom-rb/rom-sql/compare/v2.1.0...v2.2.0)
|
134
163
|
|
@@ -136,15 +165,15 @@
|
|
136
165
|
|
137
166
|
### Added
|
138
167
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
168
|
+
- Support for PG's range types (v-kolesnikov)
|
169
|
+
- Support for PG's `ltree` (GustavoCaso + solnic)
|
170
|
+
- Support for the `FILTER` clause (flash-gordon)
|
171
|
+
- PG's array types will use custom types for processing members ie `ltree[]` will use `LTree` type (solnic)
|
143
172
|
|
144
173
|
### Fixed
|
145
174
|
|
146
|
-
|
147
|
-
|
175
|
+
- Schema inference works with primary keys that have custom types (ie an enum PK column) (v-kolesnikov)
|
176
|
+
- Ruby warnings are gone (solnic)
|
148
177
|
|
149
178
|
[Compare v2.0.0...v2.1.0](https://github.com/rom-rb/rom-sql/compare/v2.0.0...v2.1.0)
|
150
179
|
|
@@ -152,9 +181,9 @@
|
|
152
181
|
|
153
182
|
### Added
|
154
183
|
|
155
|
-
|
156
|
-
|
157
|
-
|
184
|
+
- Support for schema plugins (flash-gordon)
|
185
|
+
- Support for auto migrations (flash-gordon)
|
186
|
+
- Add DLS for describing table indexes (flash-gordon)
|
158
187
|
|
159
188
|
```ruby
|
160
189
|
schema do
|
@@ -167,27 +196,27 @@
|
|
167
196
|
end
|
168
197
|
```
|
169
198
|
|
170
|
-
|
171
|
-
|
199
|
+
- Support for composite indexes in the auto-restrictions plugin (flash-gordon)
|
200
|
+
- `SQL::Gateway#call` calls a SQL function (flash-gordon)
|
172
201
|
|
173
202
|
```ruby
|
174
203
|
gateway.(:upper, 'foo') # => "FOO"
|
175
204
|
gateway.(:pg_advisory_xact_lock, 1234) # => nil
|
176
205
|
```
|
177
206
|
|
178
|
-
|
207
|
+
- `SQL::Gateway#run` executes a SQL string, e.g. a DDL statement (flash-gordon)
|
179
208
|
|
180
209
|
```ruby
|
181
210
|
gateway.run('set session IntervalStyle to default')
|
182
211
|
```
|
183
212
|
|
184
|
-
|
213
|
+
- `SQL::Relation#exists` joins a relation with the `EXISTS` operator (flash-gordon)
|
185
214
|
|
186
215
|
```ruby
|
187
216
|
users.exists(posts) # => users with posts
|
188
217
|
```
|
189
218
|
|
190
|
-
|
219
|
+
- Support for processing a relation in batches (flash-gordon)
|
191
220
|
|
192
221
|
```ruby
|
193
222
|
users.each_batch(size: 100) do |rel|
|
@@ -197,52 +226,51 @@
|
|
197
226
|
end
|
198
227
|
```
|
199
228
|
|
200
|
-
|
229
|
+
- `SQL::Relation#import` inserts data from another relation using the `INSERT ... AS SELECT` syntax which is often far more effective than row-by-row processing and an ordinary multi-insert. Relations defined on another gateway are also supported, and in this case, the implementation falls back to the multi-insert strategy (flash-gordon)
|
201
230
|
|
202
231
|
```ruby
|
203
232
|
users.import(authors.select { first_name.concat(last_name).as(:name) })
|
204
233
|
```
|
205
234
|
|
206
|
-
|
207
|
-
|
235
|
+
- Support for `tinytext`, `text`, `mediumtext`, and `longtext data types in MySQL (panthomakos)
|
236
|
+
- The new `pg_explain` plugin for getting query plans on PostgreSQL (flash-gordon)
|
208
237
|
|
209
238
|
```ruby
|
210
239
|
users.by_pk(1).explain(format: :json, analyze: true)
|
211
240
|
```
|
212
241
|
|
213
|
-
|
242
|
+
- Support for window function calls
|
214
243
|
|
215
244
|
```ruby
|
216
245
|
employees.select { [dep_no, salary, integer::avg(salary).over(partition: dep_no, order: id).as(:avg_salary)] }
|
217
246
|
```
|
218
247
|
|
219
|
-
|
248
|
+
- Function result can be negated, also `ROM::SQL::Function#not` was added (flash-gordon)
|
220
249
|
|
221
250
|
```ruby
|
222
251
|
users.where { !lower(name).is('John') }
|
223
252
|
users.where { lower(name).not('John') }
|
224
253
|
```
|
225
254
|
|
226
|
-
|
227
255
|
### Changed
|
228
256
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
257
|
+
- [BREAKING] based on rom 4.0 now (flash-gordon + solnic)
|
258
|
+
- [BREAKING] `Associates` command plugin requires associations now (solnic)
|
259
|
+
- [BREAKING] `Command#transaction` is gone in favor of `Relation#transaction` (solnic)
|
260
|
+
- [BREAKING] `PG::JSONArray`, `PG::JSONBArray`, `PG::JSONHash`, and `PG::JSONBHash` types were dropped, use `PG::JSON` and `PG::JSONB` instead (flash-gordon)
|
261
|
+
- [BREAKING] The `pg_hstore` extension now doesn't get loaded automatically, use the `:extension` option to load it on config initialization (flash-gordon)
|
262
|
+
- `ManyToOne` no longer uses a join (solnic)
|
263
|
+
- `AutoCombine` and `AutoWrap` plugins were removed as this functionality is provided by core API (solnic)
|
264
|
+
- Foreign keys are indexed by default (flash-gordon)
|
265
|
+
- Schemas are qualified by default (solnic)
|
266
|
+
- `PG::JSON`, `PG::JSONB`, and `PG::Array` now all have read types so that they return plain Hash/Array values instead of Sequel's wrappers (flash-gordon)
|
239
267
|
|
240
268
|
### Fixed
|
241
269
|
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
270
|
+
- Self-ref associations work correctly with custom FKs (solnic)
|
271
|
+
- Aliased associations with custom FKs work correctly (solnic)
|
272
|
+
- Defining a custom dataset block no longer prevents default views like `by_pk` to be defined (solnic)
|
273
|
+
- `Relation#group` uses canonical schema now (solnic)
|
246
274
|
|
247
275
|
[Compare v1.3.3...master](https://github.com/rom-rb/rom-sql/compare/v1.3.3...master)
|
248
276
|
|
@@ -250,15 +278,15 @@
|
|
250
278
|
|
251
279
|
### Added
|
252
280
|
|
253
|
-
|
254
|
-
|
255
|
-
|
281
|
+
- `Relation#lock`, row-level locking using the `SELECT FOR UPDATE` clause (flash-gordon)
|
282
|
+
- `get` and `get_text` methods for the `PG::JSON` type (flash-gordon)
|
283
|
+
- Support for converting data type with `CAST` using the function DSL (flash-gordon)
|
256
284
|
|
257
285
|
```ruby
|
258
286
|
users.select { string::cast(id, 'varchar').as(:id_str) }
|
259
287
|
```
|
260
288
|
|
261
|
-
|
289
|
+
- Support for`EXISTS` (v-kolesnikov)
|
262
290
|
|
263
291
|
```ruby
|
264
292
|
subquery = tasks.where(tasks[:user_id].qualified => users[:id].qualified)
|
@@ -267,7 +295,7 @@
|
|
267
295
|
|
268
296
|
### Fixed
|
269
297
|
|
270
|
-
|
298
|
+
- Fixed a regression introduced in v1.3.2 caused by doing way more work processing the default dataset (flash-gordon)
|
271
299
|
|
272
300
|
[Compare v1.3.2...v1.3.3](https://github.com/rom-rb/rom-sql/compare/v1.3.2...v1.3.3)
|
273
301
|
|
@@ -275,13 +303,13 @@
|
|
275
303
|
|
276
304
|
### Added
|
277
305
|
|
278
|
-
|
279
|
-
|
280
|
-
|
306
|
+
- Support for filtering with a SQL function in the `WHERE` clause. Be sure you're using it wisely and don't call it on large datasets ;) (flash-gordon)
|
307
|
+
- `Void` type for calling functions without returning value (flash-gordon)
|
308
|
+
- Support for [`PG::Array` transformations and queries](https://github.com/rom-rb/rom-sql/blob/15019a40e2cf2a224476184c4cddab4062a2cc01/lib/rom/sql/extensions/postgres/types.rb#L23-L148) (flash-gordon)
|
281
309
|
|
282
310
|
### Fixed
|
283
311
|
|
284
|
-
|
312
|
+
- A bunch of warnings from Sequel 4.46
|
285
313
|
|
286
314
|
[Compare v1.3.1...v1.3.2](https://github.com/rom-rb/rom-sql/compare/v1.3.1...v1.3.2)
|
287
315
|
|
@@ -289,7 +317,7 @@
|
|
289
317
|
|
290
318
|
### Changed
|
291
319
|
|
292
|
-
|
320
|
+
- [internal] Compatibility with `dry-core` v0.3.0 (flash-gordon)
|
293
321
|
|
294
322
|
[Compare v1.3.0...v1.3.1](https://github.com/rom-rb/rom-sql/compare/v1.3.0...v1.3.1)
|
295
323
|
|
@@ -297,22 +325,22 @@
|
|
297
325
|
|
298
326
|
### Added
|
299
327
|
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
328
|
+
- New `Relation#exist?` predicate checks if the relation has at least one tuple (flash-gordon)
|
329
|
+
- Support for [JSONB transformations and queries](https://github.com/rom-rb/rom-sql/blob/15019a40e2cf2a224476184c4cddab4062a2cc01/lib/rom/sql/extensions/postgres/types.rb#L170-L353) using native DSL (flash-gordon)
|
330
|
+
- Add `ROM::SQL::Attribute#not` for negated boolean equality expressions (AMHOL)
|
331
|
+
- Add `ROM::SQL::Attribute#!` for negated attribute's sql expressions (solnic)
|
332
|
+
- Inferrer gets limit constraints for string data types and stores them in type's meta (v-kolesnikov)
|
305
333
|
|
306
334
|
### Fixed
|
307
335
|
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
336
|
+
- Fixed usage of PostgreSQL's commands with a composite relation (flash-gordon)
|
337
|
+
- Translation of `true/false/nil` equality checks to `is/is not` SQL statements in `ROM::SQL::Attribute#is` (AMHOL)
|
338
|
+
- `associates` command plugin coerces parent collections to hashes correctly (aarek+solnic)
|
339
|
+
- `by_pk` works correctly even when PK is not projected (solnic)
|
312
340
|
|
313
341
|
### Changed
|
314
342
|
|
315
|
-
|
343
|
+
- Global private interface `SQL::Gateway.instance` has been deprecated. Now if you run migrations
|
316
344
|
with ROM you should set up a ROM config in the `db:setup` task with something similar to
|
317
345
|
|
318
346
|
```ruby
|
@@ -329,7 +357,7 @@
|
|
329
357
|
|
330
358
|
### Changed
|
331
359
|
|
332
|
-
|
360
|
+
- Updated `dry-initializer` (flash-gordon)
|
333
361
|
|
334
362
|
[Compare v1.2.1...v1.2.2](https://github.com/rom-rb/rom-sql/compare/v1.2.1...v1.2.2)
|
335
363
|
|
@@ -337,7 +365,7 @@
|
|
337
365
|
|
338
366
|
### Fixed
|
339
367
|
|
340
|
-
|
368
|
+
- Allow for joining by a `RelationProxy` instance from `rom-repository` (davydovanton)
|
341
369
|
|
342
370
|
[Compare v1.2.0...v1.2.1](https://github.com/rom-rb/rom-sql/compare/v1.2.0...v1.2.1)
|
343
371
|
|
@@ -345,9 +373,9 @@
|
|
345
373
|
|
346
374
|
### Added
|
347
375
|
|
348
|
-
|
349
|
-
|
350
|
-
|
376
|
+
- Support for configuring multiple associations for a command (solnic)
|
377
|
+
- Support for passing parent tuple(s) as `parent` option in `Command#with_association` (solnic)
|
378
|
+
- Support for join using assocation name (flash-gordon)
|
351
379
|
|
352
380
|
[Compare v1.1.2...v1.2.0](https://github.com/rom-rb/rom-sql/compare/v1.1.2...v1.2.0)
|
353
381
|
|
@@ -355,7 +383,7 @@
|
|
355
383
|
|
356
384
|
### Fixed
|
357
385
|
|
358
|
-
|
386
|
+
- Fix grouping by a function in the block DSL (flash-gordon)
|
359
387
|
|
360
388
|
[Compare v1.1.1...v1.1.2](https://github.com/rom-rb/rom-sql/compare/v1.1.1...v1.1.2)
|
361
389
|
|
@@ -363,7 +391,7 @@
|
|
363
391
|
|
364
392
|
### Fixed
|
365
393
|
|
366
|
-
|
394
|
+
- Restriction conditions with an array as a value are handled correctly by attribute types (solnic)
|
367
395
|
|
368
396
|
[Compare v1.1.0...v1.1.1](https://github.com/rom-rb/rom-sql/compare/v1.1.0...v1.1.1)
|
369
397
|
|
@@ -371,15 +399,15 @@
|
|
371
399
|
|
372
400
|
### Added
|
373
401
|
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
402
|
+
- Added inferring for database indices (flash-gordon)
|
403
|
+
- Restriction conditions are now coerced using schema attributes (solnic)
|
404
|
+
- `:instrumentation` relation plugin that can be configured with any instrumentation backend (solnic)
|
405
|
+
- `:auto_restrictions` relation plugin, which defines `by_*` views restricting relations by their indexed attributes (solnic)
|
378
406
|
|
379
407
|
### Fixed
|
380
408
|
|
381
|
-
|
382
|
-
|
409
|
+
- Missing `group` method was added to legacy `SequelAPI` module (solnic)
|
410
|
+
- Associations properly maintain `order` if it was set (solnic)
|
383
411
|
|
384
412
|
[Compare v1.0.3...v1.1.0](https://github.com/rom-rb/rom-sql/compare/v1.0.3...v1.1.0)
|
385
413
|
|
@@ -387,11 +415,11 @@
|
|
387
415
|
|
388
416
|
### Changed
|
389
417
|
|
390
|
-
|
418
|
+
- `AutoCombine#preload` uses better restriction for `ManyToOne` association which greatly speeds up loading bigger amounts of data (solnic + flash-gordon)
|
391
419
|
|
392
420
|
### Fixed
|
393
421
|
|
394
|
-
|
422
|
+
- Fix the usage of timestamp in command chains (cflipse)
|
395
423
|
|
396
424
|
[Compare v1.0.2...v1.0.3](https://github.com/rom-rb/rom-sql/compare/v1.0.2...v1.0.3)
|
397
425
|
|
@@ -399,7 +427,7 @@
|
|
399
427
|
|
400
428
|
### Added
|
401
429
|
|
402
|
-
|
430
|
+
- Support for selecting literal strings via `` select { `'foo'`.as(:bar) } `` (solnic)
|
403
431
|
|
404
432
|
[Compare v1.0.1...v1.0.2](https://github.com/rom-rb/rom-sql/compare/v1.0.1...v1.0.2)
|
405
433
|
|
@@ -407,14 +435,14 @@
|
|
407
435
|
|
408
436
|
### Added
|
409
437
|
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
438
|
+
- Support for inferring the PostgreSQL `hstore` data type (flash-gordon)
|
439
|
+
- Support for the rest of geometric PostgreSQL data types (box, lseg, polygon, etc.) (Morozzzko)
|
440
|
+
- Added inferring for timestamp types with specified precision (flash-gordon)
|
441
|
+
- Added `ROM::SQL::Attribute#in` to support range checks in conditions (flash-gordon)
|
414
442
|
|
415
443
|
### Fixed
|
416
444
|
|
417
|
-
|
445
|
+
- Missing primary key now leads to a more meaningful error (flash-gordon)
|
418
446
|
|
419
447
|
[Compare v1.0.0...v1.0.1](https://github.com/rom-rb/rom-sql/compare/v1.0.0...v1.0.1)
|
420
448
|
|
@@ -426,37 +454,37 @@ Please refer to [the upgrading guide](https://github.com/rom-rb/rom-sql/wiki/Upg
|
|
426
454
|
|
427
455
|
### Added
|
428
456
|
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
457
|
+
- [BREAKING] All relations have schemas (inferred by default, but still possible to override and/or extend) (solnic)
|
458
|
+
- [BREAKING] Schemas are used when defining relation views (solnic)
|
459
|
+
- [BREAKING] Default dataset is set up based on schema (solnic)
|
460
|
+
- Extended query API with support for schema attributes (solnic)
|
461
|
+
- Schemas can project relations automatically (solnic)
|
462
|
+
- New `Schema#qualified` (solnic)
|
463
|
+
- New `Relation#assoc` method which is a shortcut for accessing relation created by the given association (solnic)
|
464
|
+
- Schema attribute types are now SQL-specific and compatible with query DSL (ie you can pass relation attributes to `select` and they will be automatically converted to valid SQL expressions) (solnic)
|
465
|
+
- Associations support setting custom `view` that will be used to extend association relation (solnic)
|
466
|
+
- Associations support setting custom `foreign_key` names (solnic)
|
467
|
+
- Update commands has `:associates` plugin enabled (solnic)
|
468
|
+
- Support for self-referencing associations (ie categories have_many child categories) (solnic)
|
469
|
+
- Inferrers for mysql and sqlite were added (flash-gordon)
|
470
|
+
- PG's auto-inferrer can handle `inet`/`cidr`/`point` data types in a two-way manner, i.e. converting them back and forth on reading and writing (flash-gordon)
|
471
|
+
- Support for inferring more PG types: `macaddr`, `xml` (flash-gordon)
|
472
|
+
- `ROM::SQL::Relation::SequelAPI` extension for backward-compatible query API (this will be deprecated in 1.1.0 and removed in 2.0.0) (solnic)
|
473
|
+
- Added `Object` type for `SQLite` which is used by the inferrer for columns without a type affinity (flash-gordon)
|
474
|
+
- Support for composite PKs in the default `by_pk` view (solnic)
|
447
475
|
|
448
476
|
### Changed
|
449
477
|
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
478
|
+
- [BREAKING] `Relation#header` has been removed in favor of schemas (solnic)
|
479
|
+
- [BREAKING] `Relation#base` has been removed as now a vanilla relation _is a base relation view_ (solnic)
|
480
|
+
- [BREAKING] Deprecated `Relation.primary_key` has been removed in favor of schema (solnic)
|
481
|
+
- [BREAKING] Deprecated `Commands::Update#change` has been removed (solnic)
|
482
|
+
- [BREAKING] Deprecated `Commands.validator` has been removed (solnic)
|
483
|
+
- [BREAKING] `assoc_macros` plugin has been removed, please use associations from now (solnic)
|
484
|
+
- Default `by_pk` uses schema attributes, it will raise exception if PK attribute is missing in the schema (solnic)
|
485
|
+
- [internal] Associations use schemas for relation projections (solnic)
|
486
|
+
- [internal] `select`, `select_append`, `project`, `inner_join` and `left_join` use schemas internally (solnic)
|
487
|
+
- [internal] Deprecation and constants are now based on dry-core (flash-gordon)
|
460
488
|
|
461
489
|
[Compare v0.9.1...v1.0.0](https://github.com/rom-rb/rom-sql/compare/v0.9.1...v1.0.0)
|
462
490
|
|
@@ -464,8 +492,8 @@ Please refer to [the upgrading guide](https://github.com/rom-rb/rom-sql/wiki/Upg
|
|
464
492
|
|
465
493
|
### Added
|
466
494
|
|
467
|
-
|
468
|
-
|
495
|
+
- Support for PG enums in schema inferrer (flash-gordon)
|
496
|
+
- `ROM::SQL::Relation#read` method which accepts an SQL string and returns a new relation (solnic)
|
469
497
|
|
470
498
|
[Compare v0.9.0...v0.9.1](https://github.com/rom-rb/rom-sql/compare/v0.9.0...v0.9.1)
|
471
499
|
|
@@ -473,22 +501,22 @@ Please refer to [the upgrading guide](https://github.com/rom-rb/rom-sql/wiki/Upg
|
|
473
501
|
|
474
502
|
### Added
|
475
503
|
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
504
|
+
- `Associations::{OneToMany,OneToOne}#associate` for merging FKs into child tuple (jodosha)
|
505
|
+
- Added support for PostgreSQL types: UUID, Array, JSONB and Money (jodosha)
|
506
|
+
- Support for DB specific schema inferrers (flash-gordon)
|
507
|
+
- Automatically infer PG arrays and JSON(B) types (jodosha + flash-gordon)
|
508
|
+
- Support for `Relation#having` (cflipse)
|
481
509
|
|
482
510
|
### Changed
|
483
511
|
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
512
|
+
- Inferred types in schemas **are no longer strict** (flash-gordon)
|
513
|
+
- PG-specific types are handled by `:postgres` extension and it loads connection extensions automatically (flash-gordon)
|
514
|
+
- Make `OneToOne` inherit from `OneToMany` (beauby)
|
515
|
+
- Default dataset will use column names from schema if it's available (solnic)
|
488
516
|
|
489
517
|
### Fixed
|
490
518
|
|
491
|
-
|
519
|
+
- Floats are inferred by schemas (cflipse)
|
492
520
|
|
493
521
|
[Compare v0.8.0...v0.9.0](https://github.com/rom-rb/rom-sql/compare/v0.8.0...v0.9.0)
|
494
522
|
|
@@ -496,27 +524,27 @@ Please refer to [the upgrading guide](https://github.com/rom-rb/rom-sql/wiki/Upg
|
|
496
524
|
|
497
525
|
### Added
|
498
526
|
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
527
|
+
- Support for relation schemas with SQL-specific data types (solnic + flash-gordon)
|
528
|
+
- One-To-Many support in schemas (solnic + flash-gordon)
|
529
|
+
- One-To-One support in schemas (solnic + flash-gordon)
|
530
|
+
- One-To-One-Through support in schemas (solnic + flash-gordon)
|
531
|
+
- Many-To-One support in schemas (solnic + flash-gordon)
|
532
|
+
- Many-To-Many support in schemas (solnic + flash-gordon)
|
533
|
+
- Support for `has_many`, `has_one` and `belongs_to` convenient methods in schema DSL (solnic)
|
534
|
+
- Support for custom PG types: `Types::PG::Array`, `Types::PG::Hash`, `Types::PG::JSON`, and `Types::PG::Bytea` (solnic + flash-gordon)
|
535
|
+
- Optional automatic schema inference for attributes and foreign keys based on DB metadata provided by Sequel (flash-gordon)
|
536
|
+
- Support for arbitrary dataset and FK names in schemas (flash-gordon)
|
537
|
+
- Support for native upserts in PostgreSQL >= 9.5 via `Commands::Postgres::Upsert` (gotar + flash-gordon)
|
510
538
|
|
511
539
|
### Changed
|
512
540
|
|
513
|
-
|
514
|
-
|
515
|
-
|
541
|
+
- `Create` and `Update` commands have `:schema` plugin enabled by default which sets input handler based on schema definition automatically (solnic)
|
542
|
+
- `associates` command plugin uses schema associations now (solnic)
|
543
|
+
- Dropped MRI 2.0.x support
|
516
544
|
|
517
545
|
### Fixed
|
518
546
|
|
519
|
-
|
547
|
+
- `Create` command properly materialize result when `:one` is set (AMHOL)
|
520
548
|
|
521
549
|
[Compare v0.7.0...v0.8.0](https://github.com/rom-rb/rom-sql/compare/v0.7.0...v0.8.0)
|
522
550
|
|
@@ -524,26 +552,26 @@ Please refer to [the upgrading guide](https://github.com/rom-rb/rom-sql/wiki/Upg
|
|
524
552
|
|
525
553
|
### Added
|
526
554
|
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
555
|
+
- Repository plugins have been imported:
|
556
|
+
- `view` allows defining a relation view with an explicit header (solnic)
|
557
|
+
- `base_view` defines a base view with all column names as the header (solnic)
|
558
|
+
- `auto_combine` defines a generic `for_combine` method which eager-loads
|
531
559
|
parent/children relation (solnic)
|
532
|
-
|
560
|
+
- `auto-wrap` defines a generic `for_wrap` method which inner-joins
|
533
561
|
a parent/children relation (solnic)
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
562
|
+
- Possibility to check for pending migrations (gotar)
|
563
|
+
- `Relation#sum` interface (gotar)
|
564
|
+
- `Relation#avg` interface (gotar)
|
565
|
+
- `Relation#min` interface (gotar)
|
566
|
+
- `Relation#max` interface (gotar)
|
567
|
+
- `Relation#union` interface (spscream)
|
568
|
+
- `primary_key` macro which allows setting a custom primary key when it cannot be
|
569
|
+
inferred automatically (solnic)
|
542
570
|
|
543
571
|
### Changed
|
544
572
|
|
545
|
-
|
546
|
-
|
573
|
+
- `ROM::SQL.gateway` renamed to `ROM::SQL::Gateway.instance` for migrations (endash)
|
574
|
+
- Association macros are now an optional plugin (solnic)
|
547
575
|
|
548
576
|
[Compare v0.6.1...v0.7.0](https://github.com/rom-rb/rom-sql/compare/v0.6.1...v0.7.0)
|
549
577
|
|
@@ -551,7 +579,7 @@ Please refer to [the upgrading guide](https://github.com/rom-rb/rom-sql/wiki/Upg
|
|
551
579
|
|
552
580
|
### Added
|
553
581
|
|
554
|
-
|
582
|
+
- `Gateway` accepts `:extensions` as an option (c0)
|
555
583
|
|
556
584
|
[Compare v0.6.0...v0.6.1](https://github.com/rom-rb/rom-sql/compare/v0.6.0...v0.6.1)
|
557
585
|
|
@@ -565,15 +593,15 @@ Internal updates to fix deprecation warnings from ROM 0.9.0.
|
|
565
593
|
|
566
594
|
### Added
|
567
595
|
|
568
|
-
|
596
|
+
- `Relation#multi_insert` (draxxxeus)
|
569
597
|
|
570
598
|
### Changed
|
571
599
|
|
572
|
-
|
600
|
+
- Command that receives many tuples will use `multi_insert` now (draxxxeus)
|
573
601
|
|
574
602
|
### Fixed
|
575
603
|
|
576
|
-
|
604
|
+
- Relation name and join key fixes for `many_to_one` macro (jamesmoriarty)
|
577
605
|
|
578
606
|
[Compare v0.5.2...v0.5.3](https://github.com/rom-rb/rom-sql/compare/v0.5.2...v0.5.3)
|
579
607
|
|
@@ -581,12 +609,12 @@ Internal updates to fix deprecation warnings from ROM 0.9.0.
|
|
581
609
|
|
582
610
|
### Added
|
583
611
|
|
584
|
-
|
612
|
+
- `Relation#invert` operation (nepalez)
|
585
613
|
|
586
614
|
### Changed
|
587
615
|
|
588
|
-
|
589
|
-
|
616
|
+
- Migration tasks no longer require entire ROM env (solnic)
|
617
|
+
- `Repository` => `Gateway` rename for ROM 0.8.0 compatibility (solnic)
|
590
618
|
|
591
619
|
[Compare v0.5.1...v0.5.2](https://github.com/rom-rb/rom-sql/compare/v0.5.1...v0.5.2)
|
592
620
|
|
@@ -594,11 +622,11 @@ Internal updates to fix deprecation warnings from ROM 0.9.0.
|
|
594
622
|
|
595
623
|
### Changed
|
596
624
|
|
597
|
-
|
625
|
+
- Relations won't be finalized when table(s) is/are missing (solnic)
|
598
626
|
|
599
627
|
### Fixed
|
600
628
|
|
601
|
-
|
629
|
+
- Wrap errors when calling commands with `[]`-syntax (kwando)
|
602
630
|
|
603
631
|
[Compare v0.5.0...v0.5.1](https://github.com/rom-rb/rom-sql/compare/v0.5.0...v0.5.1)
|
604
632
|
|
@@ -606,20 +634,20 @@ Internal updates to fix deprecation warnings from ROM 0.9.0.
|
|
606
634
|
|
607
635
|
### Added
|
608
636
|
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
637
|
+
- Association macros support addition `:on` option (solnic)
|
638
|
+
- `associates` plugin for `Create` command (solnic)
|
639
|
+
- Support for NotNullConstraintError (solnic)
|
640
|
+
- Support for UniqueConstraintConstraintError (solnic)
|
641
|
+
- Support for ForeignKeyConstraintError (solnic)
|
642
|
+
- Support for CheckConstraintError (solnic)
|
643
|
+
- `Commands::Update#original` supports objects coercible to_h now (solnic)
|
616
644
|
|
617
645
|
### Changed
|
618
646
|
|
619
|
-
|
647
|
+
- [BREAKING] Constraint errors are no longer command errors which means `try` and
|
620
648
|
`transaction` blocks will not catch them (solnic)
|
621
|
-
|
622
|
-
|
649
|
+
- `Commands::Update#set` has been deprecated (solnic)
|
650
|
+
- `Commands::Update#to` has been deprecated (solnic)
|
623
651
|
|
624
652
|
[Compare v0.4.3...v0.5.0](https://github.com/rom-rb/rom-sql/compare/v0.4.2...v0.5.0)
|
625
653
|
|
@@ -627,7 +655,7 @@ Internal updates to fix deprecation warnings from ROM 0.9.0.
|
|
627
655
|
|
628
656
|
### Fixed
|
629
657
|
|
630
|
-
|
658
|
+
- `transaction` doesn't swallow errors now other than CommandError (solnic)
|
631
659
|
|
632
660
|
[Compare v0.4.2...v0.4.3](https://github.com/rom-rb/rom-sql/compare/v0.4.2...v0.4.3)
|
633
661
|
|
@@ -635,19 +663,19 @@ Internal updates to fix deprecation warnings from ROM 0.9.0.
|
|
635
663
|
|
636
664
|
### Added
|
637
665
|
|
638
|
-
|
639
|
-
|
640
|
-
|
666
|
+
- Support for setting custom association name (solnic)
|
667
|
+
- Support for `:conditions` option in association definition (solnic)
|
668
|
+
- Better error message when accessing undefined associations (pdswan)
|
641
669
|
|
642
670
|
### Fixed
|
643
671
|
|
644
|
-
|
672
|
+
- Correct `ROM::SQL::Plugin::Pagination::Pager#total_pages` when total is not
|
645
673
|
evenly divisible by page size (larribas)
|
646
|
-
|
674
|
+
- `association_join` behaves correctly when dataset is different than register_as (nepalez)
|
647
675
|
|
648
676
|
### Changed
|
649
677
|
|
650
|
-
|
678
|
+
- `transaction` returns command failure objects when there was a rollback (solnic)
|
651
679
|
|
652
680
|
[Compare v0.4.1...v0.4.2](https://github.com/rom-rb/rom-sql/compare/v0.4.1...v0.4.2)
|
653
681
|
|
@@ -655,8 +683,8 @@ Internal updates to fix deprecation warnings from ROM 0.9.0.
|
|
655
683
|
|
656
684
|
### Added
|
657
685
|
|
658
|
-
|
659
|
-
|
686
|
+
- Database error handling for update and delete commands (kwando + solnic)
|
687
|
+
- Migration interface as a repository plugin (gotar + solnic)
|
660
688
|
|
661
689
|
[Compare v0.4.0...v0.4.1](https://github.com/rom-rb/rom-sql/compare/v0.4.0...v0.4.1)
|
662
690
|
|
@@ -664,20 +692,20 @@ Internal updates to fix deprecation warnings from ROM 0.9.0.
|
|
664
692
|
|
665
693
|
### Added
|
666
694
|
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
695
|
+
- `ROM::SQL::Relation` which explictly defines an interface on top of Sequel (solnic + mcls)
|
696
|
+
- Postgres-specific Create and Update commands that support RETURNING (gotar + solnic)
|
697
|
+
- `Update#change` interface for skipping execution when there's no diff (solnic)
|
698
|
+
- Experimental migration API using sequel/migrations (gotar)
|
699
|
+
- Pagination plugin (solnic)
|
700
|
+
- Allow reuse of established Sequel connections (splattael)
|
673
701
|
|
674
702
|
### Changed
|
675
703
|
|
676
|
-
|
704
|
+
- Use ROM's own inflector which uses either ActiveSupport or Inflecto backends (mjtko)
|
677
705
|
|
678
706
|
### Fixed
|
679
707
|
|
680
|
-
|
708
|
+
- Indentation in Rails logger (morgoth)
|
681
709
|
|
682
710
|
[Compare v0.3.2...v0.4.0](https://github.com/rom-rb/rom-sql/compare/v0.3.2...v0.4.0)
|
683
711
|
|
@@ -685,7 +713,7 @@ Internal updates to fix deprecation warnings from ROM 0.9.0.
|
|
685
713
|
|
686
714
|
### Fixed
|
687
715
|
|
688
|
-
|
716
|
+
- Checking tuple count in commands (solnic)
|
689
717
|
|
690
718
|
[Compare v0.3.1...v0.3.2](https://github.com/rom-rb/rom-sql/compare/v0.3.1...v0.3.2)
|
691
719
|
|
@@ -693,8 +721,8 @@ Internal updates to fix deprecation warnings from ROM 0.9.0.
|
|
693
721
|
|
694
722
|
### Added
|
695
723
|
|
696
|
-
|
697
|
-
|
724
|
+
- `Adapter#disconnect` (solnic)
|
725
|
+
- Support for extra connection options (solnic)
|
698
726
|
|
699
727
|
[Compare v0.3.0...v0.3.1](https://github.com/rom-rb/rom-sql/compare/v0.3.0...v0.3.1)
|
700
728
|
|
@@ -702,8 +730,8 @@ Internal updates to fix deprecation warnings from ROM 0.9.0.
|
|
702
730
|
|
703
731
|
### Changed
|
704
732
|
|
705
|
-
|
706
|
-
|
733
|
+
- `association_join` now uses Sequel's `graph` interface which qualifies columns automatically (solnic)
|
734
|
+
- Delete command returns deleted tuples (solnic)
|
707
735
|
|
708
736
|
[Compare v0.2.0...v0.3.0](https://github.com/rom-rb/rom-sql/compare/v0.2.0...v0.3.0)
|
709
737
|
|
@@ -711,9 +739,9 @@ Internal updates to fix deprecation warnings from ROM 0.9.0.
|
|
711
739
|
|
712
740
|
### Added
|
713
741
|
|
714
|
-
|
715
|
-
|
716
|
-
|
742
|
+
- Command API (solnic)
|
743
|
+
- Support for ActiveSupport::Notifications with a log subscriber (solnic)
|
744
|
+
- New `ROM::SQL::Adapter#dataset?(name)` checking if a given table exists (solnic)
|
717
745
|
|
718
746
|
[Compare v0.1.1...v0.2.0](https://github.com/rom-rb/rom-sql/compare/v0.1.1...v0.2.0)
|
719
747
|
|
@@ -721,11 +749,11 @@ Internal updates to fix deprecation warnings from ROM 0.9.0.
|
|
721
749
|
|
722
750
|
### Fixed
|
723
751
|
|
724
|
-
|
752
|
+
- Equalizer in header (solnic)
|
725
753
|
|
726
754
|
### Changed
|
727
755
|
|
728
|
-
|
756
|
+
- minor refactor in adapter (solnic)
|
729
757
|
|
730
758
|
[Compare v0.1.0...v0.1.1](https://github.com/rom-rb/rom-sql/compare/v0.1.0...v0.1.1)
|
731
759
|
|