sequel 5.31.0 → 5.36.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +90 -0
- data/README.rdoc +1 -1
- data/doc/advanced_associations.rdoc +4 -4
- data/doc/association_basics.rdoc +10 -5
- data/doc/code_order.rdoc +12 -2
- data/doc/dataset_filtering.rdoc +2 -2
- data/doc/model_dataset_method_design.rdoc +1 -1
- data/doc/model_plugins.rdoc +1 -1
- data/doc/release_notes/5.32.0.txt +46 -0
- data/doc/release_notes/5.33.0.txt +24 -0
- data/doc/release_notes/5.34.0.txt +40 -0
- data/doc/release_notes/5.35.0.txt +56 -0
- data/doc/release_notes/5.36.0.txt +60 -0
- data/doc/testing.rdoc +1 -0
- data/doc/validations.rdoc +1 -1
- data/lib/sequel/adapters/odbc.rb +4 -6
- data/lib/sequel/adapters/oracle.rb +2 -1
- data/lib/sequel/adapters/shared/access.rb +6 -6
- data/lib/sequel/adapters/shared/mssql.rb +19 -9
- data/lib/sequel/adapters/shared/mysql.rb +9 -9
- data/lib/sequel/adapters/shared/oracle.rb +28 -22
- data/lib/sequel/adapters/shared/postgres.rb +57 -9
- data/lib/sequel/adapters/shared/sqlanywhere.rb +9 -9
- data/lib/sequel/adapters/shared/sqlite.rb +14 -3
- data/lib/sequel/adapters/tinytds.rb +1 -0
- data/lib/sequel/adapters/utils/mysql_mysql2.rb +1 -0
- data/lib/sequel/connection_pool/sharded_single.rb +4 -1
- data/lib/sequel/connection_pool/sharded_threaded.rb +12 -12
- data/lib/sequel/connection_pool/single.rb +1 -1
- data/lib/sequel/connection_pool/threaded.rb +2 -2
- data/lib/sequel/core.rb +318 -314
- data/lib/sequel/database/connecting.rb +1 -1
- data/lib/sequel/database/misc.rb +16 -10
- data/lib/sequel/database/query.rb +3 -1
- data/lib/sequel/database/schema_generator.rb +0 -1
- data/lib/sequel/database/schema_methods.rb +15 -16
- data/lib/sequel/database/transactions.rb +8 -5
- data/lib/sequel/dataset/placeholder_literalizer.rb +3 -7
- data/lib/sequel/dataset/query.rb +5 -4
- data/lib/sequel/deprecated.rb +3 -1
- data/lib/sequel/exceptions.rb +2 -0
- data/lib/sequel/extensions/_pretty_table.rb +1 -2
- data/lib/sequel/extensions/columns_introspection.rb +1 -2
- data/lib/sequel/extensions/connection_expiration.rb +2 -2
- data/lib/sequel/extensions/connection_validator.rb +2 -2
- data/lib/sequel/extensions/core_refinements.rb +2 -0
- data/lib/sequel/extensions/duplicate_columns_handler.rb +2 -0
- data/lib/sequel/extensions/fiber_concurrency.rb +24 -0
- data/lib/sequel/extensions/index_caching.rb +9 -7
- data/lib/sequel/extensions/integer64.rb +2 -0
- data/lib/sequel/extensions/migration.rb +1 -1
- data/lib/sequel/extensions/pg_array_ops.rb +4 -0
- data/lib/sequel/extensions/pg_enum.rb +2 -0
- data/lib/sequel/extensions/pg_extended_date_support.rb +1 -1
- data/lib/sequel/extensions/pg_hstore_ops.rb +2 -0
- data/lib/sequel/extensions/pg_inet.rb +15 -5
- data/lib/sequel/extensions/pg_interval.rb +2 -0
- data/lib/sequel/extensions/pg_json_ops.rb +46 -2
- data/lib/sequel/extensions/pg_range.rb +5 -7
- data/lib/sequel/extensions/pg_range_ops.rb +2 -0
- data/lib/sequel/extensions/pg_row.rb +0 -1
- data/lib/sequel/extensions/pg_timestamptz.rb +2 -0
- data/lib/sequel/extensions/query.rb +1 -0
- data/lib/sequel/extensions/run_transaction_hooks.rb +72 -0
- data/lib/sequel/extensions/s.rb +2 -0
- data/lib/sequel/extensions/server_block.rb +3 -3
- data/lib/sequel/extensions/symbol_aref_refinement.rb +2 -0
- data/lib/sequel/extensions/symbol_as_refinement.rb +2 -0
- data/lib/sequel/extensions/to_dot.rb +9 -3
- data/lib/sequel/model.rb +3 -1
- data/lib/sequel/model/associations.rb +54 -25
- data/lib/sequel/model/base.rb +60 -51
- data/lib/sequel/model/plugins.rb +4 -3
- data/lib/sequel/plugins/association_lazy_eager_option.rb +2 -0
- data/lib/sequel/plugins/association_multi_add_remove.rb +2 -0
- data/lib/sequel/plugins/association_pks.rb +60 -18
- data/lib/sequel/plugins/association_proxies.rb +3 -0
- data/lib/sequel/plugins/blacklist_security.rb +1 -2
- data/lib/sequel/plugins/boolean_subsets.rb +4 -1
- data/lib/sequel/plugins/class_table_inheritance.rb +28 -28
- data/lib/sequel/plugins/csv_serializer.rb +2 -0
- data/lib/sequel/plugins/dirty.rb +13 -13
- data/lib/sequel/plugins/forbid_lazy_load.rb +2 -0
- data/lib/sequel/plugins/instance_specific_default.rb +113 -0
- data/lib/sequel/plugins/json_serializer.rb +3 -7
- data/lib/sequel/plugins/lazy_attributes.rb +1 -1
- data/lib/sequel/plugins/pg_array_associations.rb +2 -3
- data/lib/sequel/plugins/prepared_statements.rb +5 -11
- data/lib/sequel/plugins/prepared_statements_safe.rb +1 -3
- data/lib/sequel/plugins/rcte_tree.rb +10 -16
- data/lib/sequel/plugins/single_table_inheritance.rb +15 -15
- data/lib/sequel/plugins/string_stripper.rb +1 -1
- data/lib/sequel/plugins/subclasses.rb +2 -0
- data/lib/sequel/plugins/validation_class_methods.rb +5 -1
- data/lib/sequel/timezones.rb +6 -4
- data/lib/sequel/version.rb +1 -1
- metadata +15 -2
data/lib/sequel/plugins/dirty.rb
CHANGED
@@ -61,6 +61,19 @@ module Sequel
|
|
61
61
|
# that were used in the update statement.
|
62
62
|
attr_reader :previous_changes
|
63
63
|
|
64
|
+
# Reset the initial values after saving.
|
65
|
+
def after_save
|
66
|
+
super
|
67
|
+
reset_initial_values
|
68
|
+
end
|
69
|
+
|
70
|
+
# Save the current changes so they are available after updating. This happens
|
71
|
+
# before after_save resets them.
|
72
|
+
def after_update
|
73
|
+
super
|
74
|
+
@previous_changes = column_changes
|
75
|
+
end
|
76
|
+
|
64
77
|
# An array with the initial value and the current value
|
65
78
|
# of the column, if the column has been changed. If the
|
66
79
|
# column has not been changed, returns nil.
|
@@ -165,19 +178,6 @@ module Sequel
|
|
165
178
|
super
|
166
179
|
end
|
167
180
|
|
168
|
-
# Reset the initial values after saving.
|
169
|
-
def after_save
|
170
|
-
super
|
171
|
-
reset_initial_values
|
172
|
-
end
|
173
|
-
|
174
|
-
# Save the current changes so they are available after updating. This happens
|
175
|
-
# before after_save resets them.
|
176
|
-
def after_update
|
177
|
-
super
|
178
|
-
@previous_changes = column_changes
|
179
|
-
end
|
180
|
-
|
181
181
|
# When changing the column value, save the initial column value. If the column
|
182
182
|
# value is changed back to the initial value, update changed columns to remove
|
183
183
|
# the column.
|
@@ -111,7 +111,9 @@ module Sequel
|
|
111
111
|
# an association, allow lazy loading that association, since the
|
112
112
|
# lazy association load will use a hash table lookup and not a query.
|
113
113
|
def allow_lazy_load_for_static_cache_associations
|
114
|
+
# :nocov:
|
114
115
|
if defined?(::Sequel::Plugins::StaticCache::ClassMethods)
|
116
|
+
# :nocov:
|
115
117
|
@association_reflections.each_value do |ref|
|
116
118
|
if ref.associated_class.is_a?(::Sequel::Plugins::StaticCache::ClassMethods)
|
117
119
|
ref[:forbid_lazy_load] = false
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# frozen-string-literal: true
|
2
|
+
|
3
|
+
module Sequel
|
4
|
+
module Plugins
|
5
|
+
# The instance_specific_default plugin exists to make it easier to use a
|
6
|
+
# global :instance_specific association option, or to warn or raise when Sequel
|
7
|
+
# has to guess which value to use :instance_specific option (Sequel defaults to
|
8
|
+
# guessing true as that is the conservative setting). It is helpful to
|
9
|
+
# use this plugin, particularly with the :warn or :raise settings, to determine
|
10
|
+
# which associations should have :instance_specific set. Setting the
|
11
|
+
# :instance_specific to false for associations that are not instance specific
|
12
|
+
# can improve performance.
|
13
|
+
#
|
14
|
+
# Associations are instance-specific if their block calls
|
15
|
+
# a model instance method, or where the value of the block varies
|
16
|
+
# based on runtime state, and the variance is outside of a delayed evaluation.
|
17
|
+
# For example, with the following three associations:
|
18
|
+
#
|
19
|
+
# Album.one_to_one :first_track, class: :Track do |ds|
|
20
|
+
# ds.where(number: 1)
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# Album.one_to_one :last_track, class: :Track do |ds|
|
24
|
+
# ds.where(number: num_tracks)
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# Album.one_to_many :recent_tracks, class: :Track do |ds|
|
28
|
+
# ds.where{date_updated > Date.today - 10}
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# +first_track+ is not instance specific, but +last_track+ and +recent_tracks+ are.
|
32
|
+
# +last_trac+ is because the +num_tracks+ call in the block is calling
|
33
|
+
# <tt>Album#num_tracks</tt>. +recent_tracks+ is because the value will change over
|
34
|
+
# time. This plugin allows you to find these cases, and set the :instance_specific
|
35
|
+
# option appropriately for them:
|
36
|
+
#
|
37
|
+
# Album.one_to_one :first_track, class: :Track, instance_specific: false do |ds|
|
38
|
+
# ds.where(number: 1)
|
39
|
+
# end
|
40
|
+
#
|
41
|
+
# Album.one_to_one :last_track, class: :Track, instance_specific: true do |ds|
|
42
|
+
# ds.where(number: num_tracks)
|
43
|
+
# end
|
44
|
+
#
|
45
|
+
# Album.one_to_many :recent_tracks, class: :Track, instance_specific: true do |ds|
|
46
|
+
# ds.where{date_updated > Date.today - 10}
|
47
|
+
# end
|
48
|
+
#
|
49
|
+
# For the +recent_tracks+ association, instead of marking it instance_specific, you
|
50
|
+
# could also use a delayed evaluation, since it doesn't actually contain
|
51
|
+
# instance-specific code:
|
52
|
+
#
|
53
|
+
# Album.one_to_many :recent_tracks, class: :Track, instance_specific: false do |ds|
|
54
|
+
# ds.where{date_updated > Sequel.delay{Date.today - 10}}
|
55
|
+
# end
|
56
|
+
#
|
57
|
+
# Possible arguments to provide when loading the plugin:
|
58
|
+
#
|
59
|
+
# true :: Set the :instance_specific option to true
|
60
|
+
# false :: Set the :instance_specific option to false
|
61
|
+
# :default :: Call super to set the :instance_specific option
|
62
|
+
# :warn :: Emit a warning before calling super to set the :instance_specific option
|
63
|
+
# :raise :: Raise a Sequel::Error if an :instance_specific option is not provided and
|
64
|
+
# an association could be instance-specific.
|
65
|
+
#
|
66
|
+
# Note that this plugin only affects associations which could be instance
|
67
|
+
# specific (those with blocks), where the :instance_specific option was not
|
68
|
+
# specified when the association was created.
|
69
|
+
#
|
70
|
+
# Usage:
|
71
|
+
#
|
72
|
+
# # Set how to handle associations that could be instance specific
|
73
|
+
# # but did not specify an :instance_specific option, for all subclasses
|
74
|
+
# # (set before creating subclasses).
|
75
|
+
# Sequel::Model.plugin :instance_specific_default, :warn
|
76
|
+
#
|
77
|
+
# # Set how to handle associations that could be instance specific
|
78
|
+
# # but did not specify an :instance_specific option, for the Album class
|
79
|
+
# Album.plugin :instance_specific_default, :warn
|
80
|
+
module InstanceSpecificDefault
|
81
|
+
# Set how to handle associations that could be instance specific but did
|
82
|
+
# not specify an :instance_specific value.
|
83
|
+
def self.configure(model, default)
|
84
|
+
model.instance_variable_set(:@instance_specific_default, default)
|
85
|
+
end
|
86
|
+
|
87
|
+
module ClassMethods
|
88
|
+
Plugins.inherited_instance_variables(self, :@instance_specific_default=>nil)
|
89
|
+
|
90
|
+
private
|
91
|
+
|
92
|
+
# Return the appropriate :instance_specific value, or warn or raise if
|
93
|
+
# configured.
|
94
|
+
def _association_instance_specific_default(name)
|
95
|
+
case @instance_specific_default
|
96
|
+
when true, false
|
97
|
+
return @instance_specific_default
|
98
|
+
when :default
|
99
|
+
# nothing
|
100
|
+
when :warn
|
101
|
+
warn("possibly instance-specific association without :instance_specific option (class: #{self}, association: #{name})", :uplevel => 3)
|
102
|
+
when :raise
|
103
|
+
raise Sequel::Error, "possibly instance-specific association without :instance_specific option (class: #{self}, association: #{name})"
|
104
|
+
else
|
105
|
+
raise Sequel::Error, "invalid value passed to instance_specific_default plugin: #{@instance_specific_default.inspect}"
|
106
|
+
end
|
107
|
+
|
108
|
+
super
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -106,17 +106,13 @@ module Sequel
|
|
106
106
|
# and breaks some aspects of the json_serializer plugin. You can undo the damage
|
107
107
|
# done by active_support/json by doing:
|
108
108
|
#
|
109
|
-
#
|
110
|
-
# def to_json(options = {})
|
111
|
-
# JSON.generate(self)
|
112
|
-
# end
|
113
|
-
# end
|
114
|
-
#
|
115
|
-
# class Hash
|
109
|
+
# module ActiveSupportBrokenJSONFix
|
116
110
|
# def to_json(options = {})
|
117
111
|
# JSON.generate(self)
|
118
112
|
# end
|
119
113
|
# end
|
114
|
+
# Array.send(:prepend, ActiveSupportBrokenJSONFix)
|
115
|
+
# Hash.send(:prepend, ActiveSupportBrokenJSONFix)
|
120
116
|
#
|
121
117
|
# Note that this will probably cause active_support/json to no longer work
|
122
118
|
# correctly in some cases.
|
@@ -98,7 +98,7 @@ module Sequel
|
|
98
98
|
end
|
99
99
|
|
100
100
|
if retrieved_with
|
101
|
-
|
101
|
+
primary_key = model.primary_key
|
102
102
|
composite_pk = true if primary_key.is_a?(Array)
|
103
103
|
id_map = {}
|
104
104
|
retrieved_with.each{|o| id_map[o.pk] = o unless o.values.has_key?(a) || o.frozen?}
|
@@ -341,10 +341,9 @@ module Sequel
|
|
341
341
|
eo[:loader] = false
|
342
342
|
|
343
343
|
eager_load_results(opts, eo) do |assoc_record|
|
344
|
-
if pks
|
344
|
+
if pks = assoc_record.get_column_value(key)
|
345
345
|
pks.each do |pkv|
|
346
|
-
|
347
|
-
objects.each do |object|
|
346
|
+
id_map[pkv].each do |object|
|
348
347
|
object.associations[name].push(assoc_record)
|
349
348
|
end
|
350
349
|
end
|
@@ -41,11 +41,9 @@ module Sequel
|
|
41
41
|
# Create a prepared statement, but modify the SQL used so that the model's columns are explicitly
|
42
42
|
# selected instead of using *, assuming that the dataset selects from a single table.
|
43
43
|
def prepare_explicit_statement(ds, type, vals=OPTS)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
if f && f.length == 1 && !ds.opts[:join] && (!s || s.empty?)
|
48
|
-
ds = ds.public_send(meth, *columns.map{|c| Sequel.identifier(c)})
|
44
|
+
s = ds.opts[:returning]
|
45
|
+
if !s || s.empty?
|
46
|
+
ds = ds.returning(*columns.map{|c| Sequel.identifier(c)})
|
49
47
|
end
|
50
48
|
|
51
49
|
prepare_statement(ds, type, vals)
|
@@ -70,9 +68,7 @@ module Sequel
|
|
70
68
|
# Return a prepared statement that can be used to insert a row using the given columns
|
71
69
|
# and return that column values for the row created.
|
72
70
|
def prepared_insert_select(cols)
|
73
|
-
|
74
|
-
cached_prepared_statement(:insert_select, prepared_columns(cols)){prepare_explicit_statement(naked.clone(:server=>dataset.opts.fetch(:server, :default)), :insert_select, prepared_statement_key_hash(cols))}
|
75
|
-
end
|
71
|
+
cached_prepared_statement(:insert_select, prepared_columns(cols)){prepare_explicit_statement(naked.clone(:server=>dataset.opts.fetch(:server, :default)), :insert_select, prepared_statement_key_hash(cols))}
|
76
72
|
end
|
77
73
|
|
78
74
|
# Return an array of two element arrays with the column symbol as the first entry and the
|
@@ -138,9 +134,7 @@ module Sequel
|
|
138
134
|
# and return the new column values.
|
139
135
|
def _insert_select_raw(ds)
|
140
136
|
if use_prepared_statements_for?(:insert_select)
|
141
|
-
|
142
|
-
_set_prepared_statement_server(ps).call(@values)
|
143
|
-
end
|
137
|
+
_set_prepared_statement_server(model.send(:prepared_insert_select, @values.keys)).call(@values)
|
144
138
|
else
|
145
139
|
super
|
146
140
|
end
|
@@ -66,9 +66,7 @@ module Sequel
|
|
66
66
|
# Merge the current values into the default values to reduce the number
|
67
67
|
# of free columns.
|
68
68
|
def before_create
|
69
|
-
|
70
|
-
@values = v.merge(values)
|
71
|
-
end
|
69
|
+
@values = model.prepared_statements_column_defaults.merge(@values)
|
72
70
|
super
|
73
71
|
end
|
74
72
|
|
@@ -192,23 +192,19 @@ module Sequel
|
|
192
192
|
:args=>((key_aliases + col_aliases) if col_aliases))
|
193
193
|
ds = r.apply_eager_dataset_changes(ds)
|
194
194
|
ds = ds.select_append(ka) unless ds.opts[:select] == nil
|
195
|
-
model.eager_load_results(r, eo.merge(:loader=>false, :
|
195
|
+
model.eager_load_results(r, eo.merge(:loader=>false, :initialize_rows=>false, :dataset=>ds, :id_map=>nil)) do |obj|
|
196
196
|
opk = prkey_conv[obj]
|
197
|
-
if parent_map
|
198
|
-
|
199
|
-
|
200
|
-
obj = idm_obj
|
201
|
-
end
|
197
|
+
if idm_obj = parent_map[opk]
|
198
|
+
key_aliases.each{|ka_| idm_obj.values[ka_] = obj.values[ka_]}
|
199
|
+
obj = idm_obj
|
202
200
|
else
|
203
201
|
obj.associations[parent] = nil
|
204
202
|
parent_map[opk] = obj
|
205
203
|
(children_map[key_conv[obj]] ||= []) << obj
|
206
204
|
end
|
207
205
|
|
208
|
-
|
209
|
-
|
210
|
-
root.associations[ancestors] << obj
|
211
|
-
end
|
206
|
+
id_map[extract_key_alias[obj]].each do |root|
|
207
|
+
root.associations[ancestors] << obj
|
212
208
|
end
|
213
209
|
end
|
214
210
|
parent_map.each do |parent_id, obj|
|
@@ -300,17 +296,15 @@ module Sequel
|
|
300
296
|
:args=>((key_aliases + col_aliases + (level ? [la] : [])) if col_aliases))
|
301
297
|
ds = r.apply_eager_dataset_changes(ds)
|
302
298
|
ds = ds.select_append(ka) unless ds.opts[:select] == nil
|
303
|
-
model.eager_load_results(r, eo.merge(:loader=>false, :
|
299
|
+
model.eager_load_results(r, eo.merge(:loader=>false, :initialize_rows=>false, :dataset=>ds, :id_map=>nil, :associations=>OPTS)) do |obj|
|
304
300
|
if level
|
305
301
|
no_cache = no_cache_level == obj.values.delete(la)
|
306
302
|
end
|
307
303
|
|
308
304
|
opk = prkey_conv[obj]
|
309
|
-
if parent_map
|
310
|
-
|
311
|
-
|
312
|
-
obj = idm_obj
|
313
|
-
end
|
305
|
+
if idm_obj = parent_map[opk]
|
306
|
+
key_aliases.each{|ka_| idm_obj.values[ka_] = obj.values[ka_]}
|
307
|
+
obj = idm_obj
|
314
308
|
else
|
315
309
|
obj.associations[childrena] = [] unless no_cache
|
316
310
|
parent_map[opk] = obj
|
@@ -163,21 +163,6 @@ module Sequel
|
|
163
163
|
super
|
164
164
|
end
|
165
165
|
|
166
|
-
# Copy the necessary attributes to the subclasses, and filter the
|
167
|
-
# subclass's dataset based on the sti_kep_map entry for the class.
|
168
|
-
def inherited(subclass)
|
169
|
-
super
|
170
|
-
key = Array(sti_key_map[subclass]).dup
|
171
|
-
sti_subclass_added(key)
|
172
|
-
rp = dataset.row_proc
|
173
|
-
subclass.set_dataset(sti_subclass_dataset(key), :inherited=>true)
|
174
|
-
subclass.instance_exec do
|
175
|
-
@dataset = @dataset.with_row_proc(rp)
|
176
|
-
@sti_key_array = key
|
177
|
-
self.simple_table = nil
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
166
|
# Return an instance of the class specified by sti_key,
|
182
167
|
# used by the row_proc.
|
183
168
|
def sti_load(r)
|
@@ -208,6 +193,21 @@ module Sequel
|
|
208
193
|
super
|
209
194
|
end
|
210
195
|
|
196
|
+
# Copy the necessary attributes to the subclasses, and filter the
|
197
|
+
# subclass's dataset based on the sti_kep_map entry for the class.
|
198
|
+
def inherited(subclass)
|
199
|
+
super
|
200
|
+
key = Array(sti_key_map[subclass]).dup
|
201
|
+
sti_subclass_added(key)
|
202
|
+
rp = dataset.row_proc
|
203
|
+
subclass.set_dataset(sti_subclass_dataset(key), :inherited=>true)
|
204
|
+
subclass.instance_exec do
|
205
|
+
@dataset = @dataset.with_row_proc(rp)
|
206
|
+
@sti_key_array = key
|
207
|
+
self.simple_table = nil
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
211
|
# If calling set_dataset manually, make sure to set the dataset
|
212
212
|
# row proc to one that handles inheritance correctly.
|
213
213
|
def set_dataset_row_proc(ds)
|
@@ -28,7 +28,7 @@ module Sequel
|
|
28
28
|
model.plugin(:input_transformer, :string_stripper){|v| (v.is_a?(String) && !v.is_a?(SQL::Blob)) ? v.strip : v}
|
29
29
|
end
|
30
30
|
def self.configure(model)
|
31
|
-
model.
|
31
|
+
model.send(:set_skipped_string_stripping_columns)
|
32
32
|
end
|
33
33
|
|
34
34
|
module ClassMethods
|
@@ -63,6 +63,8 @@ module Sequel
|
|
63
63
|
|
64
64
|
Plugins.inherited_instance_variables(self, :@subclasses=>lambda{|v| []}, :@on_subclass=>nil)
|
65
65
|
|
66
|
+
private
|
67
|
+
|
66
68
|
# Add the subclass to this model's current subclasses,
|
67
69
|
# and initialize a new subclasses instance variable
|
68
70
|
# in the subclass.
|
@@ -194,7 +194,11 @@ module Sequel
|
|
194
194
|
def validates_each(*atts, &block)
|
195
195
|
opts = extract_options!(atts)
|
196
196
|
blank_meth = db.method(:blank_object?).to_proc
|
197
|
-
|
197
|
+
i = opts[:if]
|
198
|
+
am = opts[:allow_missing]
|
199
|
+
an = opts[:allow_nil]
|
200
|
+
ab = opts[:allow_blank]
|
201
|
+
blk = if i || am || an || ab
|
198
202
|
if i.is_a?(Proc)
|
199
203
|
i = Plugins.def_sequel_method(self, "validation_class_methods_if", 0, &i)
|
200
204
|
end
|
data/lib/sequel/timezones.rb
CHANGED
@@ -4,6 +4,11 @@ module Sequel
|
|
4
4
|
@application_timezone = nil
|
5
5
|
@database_timezone = nil
|
6
6
|
@typecast_timezone = nil
|
7
|
+
@local_offsets = {}
|
8
|
+
|
9
|
+
# Backwards compatible alias
|
10
|
+
Timezones = SequelMethods
|
11
|
+
Deprecation.deprecate_constant(self, :Timezones)
|
7
12
|
|
8
13
|
# Sequel doesn't pay much attention to timezones by default, but you can set it
|
9
14
|
# handle timezones if you want. There are three separate timezone settings, application_timezone,
|
@@ -16,7 +21,7 @@ module Sequel
|
|
16
21
|
# on the environment (e.g. current user), you need to use the +named_timezones+ extension (and use
|
17
22
|
# +DateTime+ as the +datetime_class+). Sequel also ships with a +thread_local_timezones+ extensions
|
18
23
|
# which allows each thread to have its own timezone values for each of the timezones.
|
19
|
-
module
|
24
|
+
module SequelMethods
|
20
25
|
# The timezone you want the application to use. This is the timezone
|
21
26
|
# that incoming times from the database and typecasting are converted to.
|
22
27
|
attr_reader :application_timezone
|
@@ -243,7 +248,4 @@ module Sequel
|
|
243
248
|
Sequel.synchronize{@local_offsets[offset_secs] = Rational(offset_secs, 86400)}
|
244
249
|
end
|
245
250
|
end
|
246
|
-
|
247
|
-
@local_offsets = {}
|
248
|
-
extend Timezones
|
249
251
|
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 = 36
|
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.36.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: 2020-
|
11
|
+
date: 2020-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -179,6 +179,11 @@ extra_rdoc_files:
|
|
179
179
|
- doc/release_notes/5.29.0.txt
|
180
180
|
- doc/release_notes/5.30.0.txt
|
181
181
|
- doc/release_notes/5.31.0.txt
|
182
|
+
- doc/release_notes/5.32.0.txt
|
183
|
+
- doc/release_notes/5.33.0.txt
|
184
|
+
- doc/release_notes/5.34.0.txt
|
185
|
+
- doc/release_notes/5.35.0.txt
|
186
|
+
- doc/release_notes/5.36.0.txt
|
182
187
|
files:
|
183
188
|
- CHANGELOG
|
184
189
|
- MIT-LICENSE
|
@@ -231,6 +236,11 @@ files:
|
|
231
236
|
- doc/release_notes/5.3.0.txt
|
232
237
|
- doc/release_notes/5.30.0.txt
|
233
238
|
- doc/release_notes/5.31.0.txt
|
239
|
+
- doc/release_notes/5.32.0.txt
|
240
|
+
- doc/release_notes/5.33.0.txt
|
241
|
+
- doc/release_notes/5.34.0.txt
|
242
|
+
- doc/release_notes/5.35.0.txt
|
243
|
+
- doc/release_notes/5.36.0.txt
|
234
244
|
- doc/release_notes/5.4.0.txt
|
235
245
|
- doc/release_notes/5.5.0.txt
|
236
246
|
- doc/release_notes/5.6.0.txt
|
@@ -350,6 +360,7 @@ files:
|
|
350
360
|
- lib/sequel/extensions/escaped_like.rb
|
351
361
|
- lib/sequel/extensions/eval_inspect.rb
|
352
362
|
- lib/sequel/extensions/exclude_or_null.rb
|
363
|
+
- lib/sequel/extensions/fiber_concurrency.rb
|
353
364
|
- lib/sequel/extensions/freeze_datasets.rb
|
354
365
|
- lib/sequel/extensions/from_block.rb
|
355
366
|
- lib/sequel/extensions/graph_each.rb
|
@@ -386,6 +397,7 @@ files:
|
|
386
397
|
- lib/sequel/extensions/pretty_table.rb
|
387
398
|
- lib/sequel/extensions/query.rb
|
388
399
|
- lib/sequel/extensions/round_timestamps.rb
|
400
|
+
- lib/sequel/extensions/run_transaction_hooks.rb
|
389
401
|
- lib/sequel/extensions/s.rb
|
390
402
|
- lib/sequel/extensions/schema_caching.rb
|
391
403
|
- lib/sequel/extensions/schema_dumper.rb
|
@@ -454,6 +466,7 @@ files:
|
|
454
466
|
- lib/sequel/plugins/insert_returning_select.rb
|
455
467
|
- lib/sequel/plugins/instance_filters.rb
|
456
468
|
- lib/sequel/plugins/instance_hooks.rb
|
469
|
+
- lib/sequel/plugins/instance_specific_default.rb
|
457
470
|
- lib/sequel/plugins/inverted_subsets.rb
|
458
471
|
- lib/sequel/plugins/json_serializer.rb
|
459
472
|
- lib/sequel/plugins/lazy_attributes.rb
|