sequel 5.44.0 → 5.45.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 +10 -0
- data/doc/release_notes/5.45.0.txt +34 -0
- data/doc/virtual_rows.rdoc +1 -1
- data/lib/sequel/adapters/odbc.rb +5 -1
- data/lib/sequel/adapters/shared/postgres.rb +0 -12
- data/lib/sequel/adapters/shared/sqlite.rb +6 -2
- data/lib/sequel/dataset/query.rb +1 -3
- data/lib/sequel/dataset/sql.rb +7 -0
- data/lib/sequel/extensions/pg_loose_count.rb +3 -1
- data/lib/sequel/model/associations.rb +2 -0
- data/lib/sequel/plugins/auto_validations_constraint_validations_presence_message.rb +68 -0
- data/lib/sequel/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b37b49ac4a53cefbee674e57e1b64f3733ee7c330d548c59e370efe6b557cc5a
|
4
|
+
data.tar.gz: 0f7de640673c6dff3affc0c494609d96502f62d36d7c6b639c4e3dba2d90a89f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 342e7413e9a93cea694f1d1062803d4729b28f3d8adfc2f537ecd24dc988c448754c13046709d0a6505a78c0b21fb3383a1e5d55f73ee5e8364dbd0efb84fa7d
|
7
|
+
data.tar.gz: 9ea9cd35c75b670053804399f27475e38e28ea7b21062cf736e9bbea641c9d0862ef77edab6007d224a3a669a7469cab0c94658c4477e4d97a93c1c0355f031f
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
=== 5.45.0 (2021-06-01)
|
2
|
+
|
3
|
+
* Fix handling of NULL values in boolean columns in the ODBC adapter (jeremyevans) (#1765)
|
4
|
+
|
5
|
+
* Add auto_validations_constraint_validations_presence_message plugin for auto_validations/constraint_validations presence message integration (jeremyevans)
|
6
|
+
|
7
|
+
* Support Dataset#with :materialized option on SQLite 3.35+ for [NOT] MATERIALIZED (jeremyevans)
|
8
|
+
|
9
|
+
* Use ALTER TABLE DROP COLUMN for dropping columns on SQLite 3.35+ (jeremyevans)
|
10
|
+
|
1
11
|
=== 5.44.0 (2021-05-01)
|
2
12
|
|
3
13
|
* Add concurrent_eager_loading plugin, for eager loading multiple associations concurrently using separate threads (jeremyevans)
|
@@ -0,0 +1,34 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* A auto_validations_constraint_validations_presence_message plugin
|
4
|
+
has been added that provides integration for the auto_validations
|
5
|
+
and constraint_validations plugin in the following conditions:
|
6
|
+
|
7
|
+
* The column has a NOT NULL constraint
|
8
|
+
* The column has a presence constraint validation with both
|
9
|
+
the :message and :allow_nil options used.
|
10
|
+
|
11
|
+
In this case, when saving a nil value in the column, the plugin
|
12
|
+
will make it so the more specific message from the presence
|
13
|
+
constraint validation is used, instead of the generic message
|
14
|
+
from auto_validations.
|
15
|
+
|
16
|
+
= Other Improvements
|
17
|
+
|
18
|
+
* On SQLite 3.35.0+, Sequel now uses ALTER TABLE DROP COLUMN for
|
19
|
+
dropping columns, instead of emulating the dropped column by
|
20
|
+
recreating the table.
|
21
|
+
|
22
|
+
* The Dataset#with :materialized option is now supported on SQLite
|
23
|
+
3.35.0+ for specifying whether common table expressions should be
|
24
|
+
materialized.
|
25
|
+
|
26
|
+
* The odbc adapter now correct handles boolean columns with NULL
|
27
|
+
values. Previously, such values were returned as false instead
|
28
|
+
of nil.
|
29
|
+
|
30
|
+
= Backwards Compatibility
|
31
|
+
|
32
|
+
* The change to use ALTER TABLE DROP COLUMN on SQLite 3.35.0+ can
|
33
|
+
cause backwards compatibility issues if SQLite 3.35.0+ does
|
34
|
+
not allow dropping the column.
|
data/doc/virtual_rows.rdoc
CHANGED
data/lib/sequel/adapters/odbc.rb
CHANGED
@@ -94,7 +94,11 @@ module Sequel
|
|
94
94
|
self.columns = columns
|
95
95
|
s.each do |row|
|
96
96
|
hash = {}
|
97
|
-
cols.each
|
97
|
+
cols.each do |n,t,j|
|
98
|
+
v = row[j]
|
99
|
+
# We can assume v is not false, so this shouldn't convert false to nil.
|
100
|
+
hash[n] = (convert_odbc_value(v, t) if v)
|
101
|
+
end
|
98
102
|
yield hash
|
99
103
|
end
|
100
104
|
end
|
@@ -2141,18 +2141,6 @@ module Sequel
|
|
2141
2141
|
opts[:with].any?{|w| w[:recursive]} ? "WITH RECURSIVE " : super
|
2142
2142
|
end
|
2143
2143
|
|
2144
|
-
# Support WITH AS [NOT] MATERIALIZED if :materialized option is used.
|
2145
|
-
def select_with_sql_prefix(sql, w)
|
2146
|
-
super
|
2147
|
-
|
2148
|
-
case w[:materialized]
|
2149
|
-
when true
|
2150
|
-
sql << "MATERIALIZED "
|
2151
|
-
when false
|
2152
|
-
sql << "NOT MATERIALIZED "
|
2153
|
-
end
|
2154
|
-
end
|
2155
|
-
|
2156
2144
|
# The version of the database server
|
2157
2145
|
def server_version
|
2158
2146
|
db.server_version(@opts[:server])
|
@@ -239,8 +239,12 @@ module Sequel
|
|
239
239
|
super
|
240
240
|
end
|
241
241
|
when :drop_column
|
242
|
-
|
243
|
-
|
242
|
+
if sqlite_version >= 33500
|
243
|
+
super
|
244
|
+
else
|
245
|
+
ocp = lambda{|oc| oc.delete_if{|c| c.to_s == op[:name].to_s}}
|
246
|
+
duplicate_table(table, :old_columns_proc=>ocp){|columns| columns.delete_if{|s| s[:name].to_s == op[:name].to_s}}
|
247
|
+
end
|
244
248
|
when :rename_column
|
245
249
|
if sqlite_version >= 32500
|
246
250
|
super
|
data/lib/sequel/dataset/query.rb
CHANGED
@@ -1062,10 +1062,8 @@ module Sequel
|
|
1062
1062
|
# Options:
|
1063
1063
|
# :args :: Specify the arguments/columns for the CTE, should be an array of symbols.
|
1064
1064
|
# :recursive :: Specify that this is a recursive CTE
|
1065
|
-
#
|
1066
|
-
# PostgreSQL Specific Options:
|
1067
1065
|
# :materialized :: Set to false to force inlining of the CTE, or true to force not inlining
|
1068
|
-
# the CTE (PostgreSQL 12+).
|
1066
|
+
# the CTE (PostgreSQL 12+/SQLite 3.35+).
|
1069
1067
|
#
|
1070
1068
|
# DB[:items].with(:items, DB[:syx].where(Sequel[:name].like('A%')))
|
1071
1069
|
# # WITH items AS (SELECT * FROM syx WHERE (name LIKE 'A%' ESCAPE '\')) SELECT * FROM items
|
data/lib/sequel/dataset/sql.rb
CHANGED
@@ -1567,6 +1567,13 @@ module Sequel
|
|
1567
1567
|
sql << ')'
|
1568
1568
|
end
|
1569
1569
|
sql << ' AS '
|
1570
|
+
|
1571
|
+
case w[:materialized]
|
1572
|
+
when true
|
1573
|
+
sql << "MATERIALIZED "
|
1574
|
+
when false
|
1575
|
+
sql << "NOT MATERIALIZED "
|
1576
|
+
end
|
1570
1577
|
end
|
1571
1578
|
|
1572
1579
|
# Whether the symbol cache should be skipped when literalizing the dataset
|
@@ -12,7 +12,9 @@
|
|
12
12
|
#
|
13
13
|
# How accurate this count is depends on the number of rows
|
14
14
|
# added/deleted from the table since the last time it was
|
15
|
-
# analyzed.
|
15
|
+
# analyzed. If the table has not been vacuumed or analyzed
|
16
|
+
# yet, this can return 0 or -1 depending on the PostgreSQL
|
17
|
+
# version in use.
|
16
18
|
#
|
17
19
|
# To load the extension into the database:
|
18
20
|
#
|
@@ -3011,6 +3011,8 @@ module Sequel
|
|
3011
3011
|
# You can specify an custom alias and/or join type on a per-association basis by providing an
|
3012
3012
|
# Sequel::SQL::AliasedExpression object instead of an a Symbol for the association name.
|
3013
3013
|
#
|
3014
|
+
# You cannot mix calls to +eager_graph+ and +graph+ on the same dataset.
|
3015
|
+
#
|
3014
3016
|
# Examples:
|
3015
3017
|
#
|
3016
3018
|
# # For each album, eager_graph load the artist
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen-string-literal: true
|
2
|
+
|
3
|
+
module Sequel
|
4
|
+
module Plugins
|
5
|
+
# The auto_validations_constraint_validations_presence_message plugin provides
|
6
|
+
# integration for the auto_validations and constraint_validations plugins in
|
7
|
+
# the following situation:
|
8
|
+
#
|
9
|
+
# * A column has a NOT NULL constraint in the database
|
10
|
+
# * A constraint validation for presence exists on the column, with a :message
|
11
|
+
# option to set a column-specific message, and with the :allow_nil option set
|
12
|
+
# to true because the CHECK constraint doesn't need to check for NULL values
|
13
|
+
# as the column itself is NOT NULL
|
14
|
+
#
|
15
|
+
# In this case, by default the validation error message on the column will
|
16
|
+
# use the more specific constraint validation error message if the column
|
17
|
+
# has a non-NULL empty value, but will use the default auto_validations
|
18
|
+
# message if the column has a NULL value. With this plugin, the column-specific
|
19
|
+
# constraint validation error message will be used in both cases.
|
20
|
+
#
|
21
|
+
# Usage:
|
22
|
+
#
|
23
|
+
# # Make all model subclasses use this auto_validations/constraint_validations
|
24
|
+
# # integration (called before loading subclasses)
|
25
|
+
# Sequel::Model.plugin :auto_validations_constraint_validations_presence_message
|
26
|
+
#
|
27
|
+
# # Make the Album class use this auto_validations/constraint_validations integration
|
28
|
+
# Album.plugin :auto_validations_constraint_validations_presence_message
|
29
|
+
module AutoValidationsConstraintValidationsPresenceMessage
|
30
|
+
def self.apply(model)
|
31
|
+
model.plugin :auto_validations
|
32
|
+
model.plugin :constraint_validations
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.configure(model, opts=OPTS)
|
36
|
+
model.send(:_adjust_auto_validations_constraint_validations_presence_message)
|
37
|
+
end
|
38
|
+
|
39
|
+
module ClassMethods
|
40
|
+
Plugins.after_set_dataset(self, :_adjust_auto_validations_constraint_validations_presence_message)
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def _adjust_auto_validations_constraint_validations_presence_message
|
45
|
+
if @dataset &&
|
46
|
+
!@auto_validate_options[:not_null][:message] &&
|
47
|
+
!@auto_validate_options[:explicit_not_null][:message]
|
48
|
+
|
49
|
+
@constraint_validations.each do |array|
|
50
|
+
meth, column, opts = array
|
51
|
+
|
52
|
+
if meth == :validates_presence &&
|
53
|
+
opts &&
|
54
|
+
opts[:message] &&
|
55
|
+
opts[:allow_nil] &&
|
56
|
+
(@auto_validate_not_null_columns.include?(column) || @auto_validate_explicit_not_null_columns.include?(column))
|
57
|
+
|
58
|
+
@auto_validate_not_null_columns.delete(column)
|
59
|
+
@auto_validate_explicit_not_null_columns.delete(column)
|
60
|
+
array[2] = array[2].merge(:allow_nil=>false)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/lib/sequel/version.rb
CHANGED
@@ -6,7 +6,7 @@ module Sequel
|
|
6
6
|
|
7
7
|
# The minor version of Sequel. Bumped for every non-patch level
|
8
8
|
# release, generally around once a month.
|
9
|
-
MINOR =
|
9
|
+
MINOR = 45
|
10
10
|
|
11
11
|
# The tiny version of Sequel. Usually 0, only bumped for bugfix
|
12
12
|
# releases that fix regressions from previous versions.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.45.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -188,6 +188,7 @@ extra_rdoc_files:
|
|
188
188
|
- doc/release_notes/5.42.0.txt
|
189
189
|
- doc/release_notes/5.43.0.txt
|
190
190
|
- doc/release_notes/5.44.0.txt
|
191
|
+
- doc/release_notes/5.45.0.txt
|
191
192
|
- doc/release_notes/5.5.0.txt
|
192
193
|
- doc/release_notes/5.6.0.txt
|
193
194
|
- doc/release_notes/5.7.0.txt
|
@@ -260,6 +261,7 @@ files:
|
|
260
261
|
- doc/release_notes/5.42.0.txt
|
261
262
|
- doc/release_notes/5.43.0.txt
|
262
263
|
- doc/release_notes/5.44.0.txt
|
264
|
+
- doc/release_notes/5.45.0.txt
|
263
265
|
- doc/release_notes/5.5.0.txt
|
264
266
|
- doc/release_notes/5.6.0.txt
|
265
267
|
- doc/release_notes/5.7.0.txt
|
@@ -456,6 +458,7 @@ files:
|
|
456
458
|
- lib/sequel/plugins/association_proxies.rb
|
457
459
|
- lib/sequel/plugins/async_thread_pool.rb
|
458
460
|
- lib/sequel/plugins/auto_validations.rb
|
461
|
+
- lib/sequel/plugins/auto_validations_constraint_validations_presence_message.rb
|
459
462
|
- lib/sequel/plugins/before_after_save.rb
|
460
463
|
- lib/sequel/plugins/blacklist_security.rb
|
461
464
|
- lib/sequel/plugins/boolean_readers.rb
|