sequel 5.31.0 → 5.32.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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +16 -0
  3. data/doc/advanced_associations.rdoc +4 -4
  4. data/doc/association_basics.rdoc +3 -3
  5. data/doc/code_order.rdoc +12 -2
  6. data/doc/model_dataset_method_design.rdoc +1 -1
  7. data/doc/release_notes/5.32.0.txt +46 -0
  8. data/doc/testing.rdoc +1 -0
  9. data/lib/sequel/adapters/shared/access.rb +6 -6
  10. data/lib/sequel/adapters/shared/mssql.rb +5 -5
  11. data/lib/sequel/adapters/shared/mysql.rb +9 -9
  12. data/lib/sequel/adapters/shared/oracle.rb +16 -16
  13. data/lib/sequel/adapters/shared/postgres.rb +18 -8
  14. data/lib/sequel/adapters/shared/sqlanywhere.rb +9 -9
  15. data/lib/sequel/adapters/shared/sqlite.rb +1 -0
  16. data/lib/sequel/connection_pool/sharded_threaded.rb +2 -2
  17. data/lib/sequel/connection_pool/threaded.rb +1 -1
  18. data/lib/sequel/core.rb +318 -314
  19. data/lib/sequel/database/query.rb +1 -1
  20. data/lib/sequel/extensions/connection_expiration.rb +2 -2
  21. data/lib/sequel/extensions/connection_validator.rb +2 -2
  22. data/lib/sequel/extensions/fiber_concurrency.rb +24 -0
  23. data/lib/sequel/extensions/index_caching.rb +9 -7
  24. data/lib/sequel/extensions/integer64.rb +2 -0
  25. data/lib/sequel/extensions/pg_inet.rb +13 -5
  26. data/lib/sequel/extensions/pg_interval.rb +2 -0
  27. data/lib/sequel/extensions/pg_range.rb +2 -0
  28. data/lib/sequel/extensions/pg_timestamptz.rb +2 -0
  29. data/lib/sequel/extensions/run_transaction_hooks.rb +72 -0
  30. data/lib/sequel/extensions/server_block.rb +3 -3
  31. data/lib/sequel/model/base.rb +48 -47
  32. data/lib/sequel/model/plugins.rb +1 -0
  33. data/lib/sequel/plugins/association_lazy_eager_option.rb +2 -0
  34. data/lib/sequel/plugins/association_multi_add_remove.rb +2 -0
  35. data/lib/sequel/plugins/association_proxies.rb +2 -0
  36. data/lib/sequel/plugins/boolean_subsets.rb +4 -1
  37. data/lib/sequel/plugins/class_table_inheritance.rb +26 -26
  38. data/lib/sequel/plugins/dirty.rb +13 -13
  39. data/lib/sequel/plugins/json_serializer.rb +3 -7
  40. data/lib/sequel/plugins/single_table_inheritance.rb +15 -15
  41. data/lib/sequel/plugins/subclasses.rb +2 -0
  42. data/lib/sequel/timezones.rb +6 -4
  43. data/lib/sequel/version.rb +1 -1
  44. metadata +6 -2
@@ -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.
@@ -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
- # class Array
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.
@@ -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)
@@ -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.
@@ -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 Timezones
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
@@ -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 = 31
9
+ MINOR = 32
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.31.0
4
+ version: 5.32.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-04-01 00:00:00.000000000 Z
11
+ date: 2020-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -179,6 +179,7 @@ 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
182
183
  files:
183
184
  - CHANGELOG
184
185
  - MIT-LICENSE
@@ -231,6 +232,7 @@ files:
231
232
  - doc/release_notes/5.3.0.txt
232
233
  - doc/release_notes/5.30.0.txt
233
234
  - doc/release_notes/5.31.0.txt
235
+ - doc/release_notes/5.32.0.txt
234
236
  - doc/release_notes/5.4.0.txt
235
237
  - doc/release_notes/5.5.0.txt
236
238
  - doc/release_notes/5.6.0.txt
@@ -350,6 +352,7 @@ files:
350
352
  - lib/sequel/extensions/escaped_like.rb
351
353
  - lib/sequel/extensions/eval_inspect.rb
352
354
  - lib/sequel/extensions/exclude_or_null.rb
355
+ - lib/sequel/extensions/fiber_concurrency.rb
353
356
  - lib/sequel/extensions/freeze_datasets.rb
354
357
  - lib/sequel/extensions/from_block.rb
355
358
  - lib/sequel/extensions/graph_each.rb
@@ -386,6 +389,7 @@ files:
386
389
  - lib/sequel/extensions/pretty_table.rb
387
390
  - lib/sequel/extensions/query.rb
388
391
  - lib/sequel/extensions/round_timestamps.rb
392
+ - lib/sequel/extensions/run_transaction_hooks.rb
389
393
  - lib/sequel/extensions/s.rb
390
394
  - lib/sequel/extensions/schema_caching.rb
391
395
  - lib/sequel/extensions/schema_dumper.rb