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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3ea26531aa8ce58a1d98b14e4df51dc2c364285d915486baf3647347c482c96
|
4
|
+
data.tar.gz: f4588646c72d99490d19e637eede86fe9cd3421c8c2c861802c6e9bf4c3b5425
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa483b284775682fb6b33b56bcccf33bc32a22e0161964a5e8679d461dd6ac3e5e4d4575a10887e71a730d85d8b04194fb739ee122093ae797df18a4e70534c9
|
7
|
+
data.tar.gz: fcc040944c40bc0be1faf2b4eafc3e1d34ea8a409c6ef45e26ae7f25f6d38c4f7b66445902b71b05e55eaccb37c1c1ee47c29d8a5135dd45b95a8b5d50ffe0dd
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,93 @@
|
|
1
|
+
=== 5.36.0 (2020-09-01)
|
2
|
+
|
3
|
+
* Handle passing keyword arguments through class methods defined via Plugins.def_dataset_method on Ruby 2.7+ (jeremyevans)
|
4
|
+
|
5
|
+
* Handle passing keyword arguments through when loading plugins on Ruby 2.7+ (jeremyevans)
|
6
|
+
|
7
|
+
* Handle passing keyword arguments through migrations when defining custom Database methods that accept keywords on Ruby 2.7+ (jeremyevans)
|
8
|
+
|
9
|
+
* Handle passing keyword arguments through Dataset#query when using the query extension on Ruby 2.7+ (jeremyevans)
|
10
|
+
|
11
|
+
* Handle passing keyword arguments through the association proxy when using the association_proxies plugin on Ruby 2.7+ (jeremyevans)
|
12
|
+
|
13
|
+
* Handle passing keyword arguments through the class method to a method defined in dataset_module on Ruby 2.7+ (adam12) (#1713)
|
14
|
+
|
15
|
+
* Stream result sets in the odbc adapter for better performance and lower memory usage (sparrovv) (#1711)
|
16
|
+
|
17
|
+
* Add Postgres::JSONBOp#set_lax and #path_*_tz methods to the pg_json_ops extension for new jsonb functions added in PostgreSQL 13 (jeremyevans)
|
18
|
+
|
19
|
+
* Add Dataset#with_ties on PostgreSQL 13+ and Microsoft SQL Server to include rows with same order as final row (jeremyevans)
|
20
|
+
|
21
|
+
* Add a :current_schema option to Database#view_exists? (only defined on Oracle) to look in the current schema instead of non-system schemas (jeremyevans) (#1710)
|
22
|
+
|
23
|
+
* Recognize another disconnect error in the mysql and mysql2 adapters (jeremyevans) (#1706)
|
24
|
+
|
25
|
+
=== 5.35.0 (2020-08-01)
|
26
|
+
|
27
|
+
* Recognize another disconnect error in the oracle adapter (sterlzbd) (#1705)
|
28
|
+
|
29
|
+
* Consider all associations with :dataset options as instance-specific associations (jeremyevans)
|
30
|
+
|
31
|
+
* Make Model.finalize_associations not break with instance-specific associations (jeremyevans)
|
32
|
+
|
33
|
+
* Make association placeholder loader consider block if instance_specific: false association option is used (jeremyevans)
|
34
|
+
|
35
|
+
* Copy composite unique constraints when emulating alter table operations on SQLite (jeremyevans) (#1704)
|
36
|
+
|
37
|
+
* Add instance_specific_default plugin for setting default association :instance_specific value, or warning/raising for cases where it is not specified (jeremyevans)
|
38
|
+
|
39
|
+
* Make Model.plugin issue deprecation warning if loading plugin with arguments and block if plugin does not accept arguments/block (jeremyevans)
|
40
|
+
|
41
|
+
* Make validation_class_methods consider all :if, :allow_missing, :allow_nil, and :allow_blank settings, instead of just the first (jeremyevans)
|
42
|
+
|
43
|
+
* Include hash entries with nil keys in Dataset#to_dot output in to_dot extension (jeremyevans)
|
44
|
+
|
45
|
+
* Remove unneeded conditionals from plugins and extensions (jeremyevans)
|
46
|
+
|
47
|
+
* Fix exception class in run_transaction_hooks extension if calling run_after_{commit,rollback}_hooks outside of a transaction (jeremyevans)
|
48
|
+
|
49
|
+
=== 5.34.0 (2020-07-01)
|
50
|
+
|
51
|
+
* Make eager_graph work correctly if called with no associations (jeremyevans)
|
52
|
+
|
53
|
+
* Make :ruby eager limit strategy handle cases where there is no limit or offset (jeremyevans)
|
54
|
+
|
55
|
+
* Do not keep a reference to a Sequel::Database instance that raises an exception during initialization (jeremyevans)
|
56
|
+
|
57
|
+
* Make Database#pool.all_connections not yield for a single connection pool in disconnected state (jeremyevans)
|
58
|
+
|
59
|
+
* Raise an exception if trying to disconnect a server that doesn't exist in the sharded connection pools (jeremyevans)
|
60
|
+
|
61
|
+
* Support :refresh option when calling *_pks getter method in the association_pks plugin (jeremyevans)
|
62
|
+
|
63
|
+
* Support caching of repeated calls to *_pks getter method in the association_pks plugin using :cache_pks association option (jeremyevans)
|
64
|
+
|
65
|
+
* Add *_pks_dataset methods for one_to_many and many_to_many associations when using the association_pks plugin (jeremyevans)
|
66
|
+
|
67
|
+
=== 5.33.0 (2020-06-01)
|
68
|
+
|
69
|
+
* Support custom join types on a per-association basis when using eager_graph/association_join (jeremyevans)
|
70
|
+
|
71
|
+
* Support primary_key with type: :smallserial on PostgreSQL (j-a-m-l) (#1698)
|
72
|
+
|
73
|
+
* Add Database#current_timestamp_utc accessor on SQLite to keep CURRENT_* in UTC instead of converting to localtime (jeremyevans)
|
74
|
+
|
75
|
+
=== 5.32.0 (2020-05-01)
|
76
|
+
|
77
|
+
* Allow Database#create_table? work with :partition_of option on PostgreSQL (jeremyevans) (#1690)
|
78
|
+
|
79
|
+
* Add fiber_concurrency extension, for using Fiber.current instead of Thread.current for checking out connections (jeremyevans)
|
80
|
+
|
81
|
+
* Move most Sequel singleton methods into a module that extends Sequel for easier overriding (jeremyevans)
|
82
|
+
|
83
|
+
* Fix method visibility issues in model, plugin, extension, and adapter code (jeremyevans)
|
84
|
+
|
85
|
+
* Avoid defining conversion procs for PostgreSQL inet/cidr types in pg_inet extension when using sequel_pg 1.13.0+ (jeremyevans)
|
86
|
+
|
87
|
+
* Add run_transaction_hooks Database extension, allowing for running the transaction hooks before commit/rollback, for use with transactional testing (jeremyevans)
|
88
|
+
|
89
|
+
* Recognize timestamp(N) with time zone type (isc) (#1684)
|
90
|
+
|
1
91
|
=== 5.31.0 (2020-04-01)
|
2
92
|
|
3
93
|
* Fix alter_table drop_constraint :primary_key option on SQLite for non-integer primary keys (jeremyevans)
|
data/README.rdoc
CHANGED
@@ -172,7 +172,7 @@ Datasets are the primary way records are retrieved and manipulated. They are ge
|
|
172
172
|
posts = DB.from(:posts)
|
173
173
|
posts = DB[:posts] # same
|
174
174
|
|
175
|
-
Datasets will only fetch records when you tell them to. They can be manipulated to filter records, change ordering, join tables, etc
|
175
|
+
Datasets will only fetch records when you tell them to. They can be manipulated to filter records, change ordering, join tables, etc. Datasets are always frozen, and they are safe to use by multiple threads concurrently.
|
176
176
|
|
177
177
|
=== Retrieving Records
|
178
178
|
|
@@ -731,7 +731,7 @@ associations:
|
|
731
731
|
one_to_one :tracks, key: [:disc_number, :number, :album_id], primary_key: [:disc_number, :number, :album_id]
|
732
732
|
end
|
733
733
|
|
734
|
-
=== Tree - All Ancestors and
|
734
|
+
=== Tree - All Ancestors and Descendants
|
735
735
|
|
736
736
|
Let's say you want to store a tree relationship in your database, it's pretty
|
737
737
|
simple:
|
@@ -749,7 +749,7 @@ node.children. You can even eager load the relationship up to a certain depth:
|
|
749
749
|
# Load parents and grandparents for a group of nodes
|
750
750
|
Node.where{id < 10}.eager(parent: :parent).all
|
751
751
|
|
752
|
-
What if you want to get all ancestors up to the root node, or all
|
752
|
+
What if you want to get all ancestors up to the root node, or all descendants,
|
753
753
|
without knowing the depth of the tree?
|
754
754
|
|
755
755
|
class Node < Sequel::Model
|
@@ -770,7 +770,7 @@ without knowing the depth of the tree?
|
|
770
770
|
id_map = {}
|
771
771
|
# Create an map of parent_ids to nodes that have that parent id
|
772
772
|
non_root_nodes.each{|n| (id_map[n.parent_id] ||= []) << n}
|
773
|
-
# Doesn't cause an
|
773
|
+
# Doesn't cause an infinite loop, because when only the root node
|
774
774
|
# is left, this is not called.
|
775
775
|
Node.where(id: id_map.keys).eager(:ancestors).all do |node|
|
776
776
|
# Populate the parent association for each node
|
@@ -879,4 +879,4 @@ associated tickets.
|
|
879
879
|
end
|
880
880
|
|
881
881
|
Note that it is often better to use a sum cache instead of this approach. You can implement
|
882
|
-
a sum cache using +after_create+, +after_update+, and +after_delete+ hooks, or
|
882
|
+
a sum cache using +after_create+, +after_update+, and +after_delete+ hooks, or preferably using a database trigger.
|
data/doc/association_basics.rdoc
CHANGED
@@ -113,7 +113,7 @@ many rows in the current table, by using a join table to associate the two table
|
|
113
113
|
The one_through_one association can be thought of as a subset of the many_to_many
|
114
114
|
association, but where there can only be 0 or 1 records in the associated table.
|
115
115
|
This is useful if there is a unique constraint on the foreign key in the join table
|
116
|
-
that
|
116
|
+
that references the current table. It's also useful if you want to impose an order
|
117
117
|
on the association and just want the first record returned. The one_through_one
|
118
118
|
association is so named because it sets up a one-to-one association through a
|
119
119
|
single join table.
|
@@ -781,7 +781,7 @@ Sequel is designed to be very flexible. If the default behavior of the
|
|
781
781
|
association modification methods isn't what you desire, you can override
|
782
782
|
the methods in your classes. However, you should be aware that for each
|
783
783
|
of the association modification methods described, there is a private
|
784
|
-
method that is
|
784
|
+
method that is preceded by an underscore that does the actual
|
785
785
|
modification. The public method without the underscore handles caching
|
786
786
|
and callbacks, and shouldn't be overridden by the user.
|
787
787
|
|
@@ -1069,7 +1069,7 @@ option of the first association, it doesn't attempt to merge them.
|
|
1069
1069
|
In addition to the options hash, the :clone option will copy a block argument
|
1070
1070
|
from the existing situation. If you want a cloned association to not have the
|
1071
1071
|
same block as the association you are cloning from, specify the block: nil option
|
1072
|
-
in
|
1072
|
+
in addition to the :clone option.
|
1073
1073
|
|
1074
1074
|
==== :dataset
|
1075
1075
|
|
@@ -1676,11 +1676,16 @@ instances.
|
|
1676
1676
|
==== :instance_specific
|
1677
1677
|
|
1678
1678
|
This allows you to override the setting of whether the dataset contains instance
|
1679
|
-
specific code.
|
1679
|
+
specific code. If you are passing a block to the association,
|
1680
1680
|
Sequel sets this to true by default, which disables some optimizations that
|
1681
1681
|
would be invalid if the association is instance specific. If you know that the
|
1682
1682
|
block does not contain instance specific code, you can set this to false to
|
1683
|
-
reenable the optimizations.
|
1683
|
+
reenable the optimizations. Instance specific code is mostly commonly calling
|
1684
|
+
model instance methods inside an association block, but also
|
1685
|
+
includes cases where the association block can return different values based
|
1686
|
+
on the runtime environment, such as calls to <tt>Time.now</tt> in the block.
|
1687
|
+
Associations that use the :dataset option are always considered instance specific,
|
1688
|
+
even if explicitly specified otherwise.
|
1684
1689
|
|
1685
1690
|
==== :cartesian_product_number
|
1686
1691
|
|
data/doc/code_order.rdoc
CHANGED
@@ -7,7 +7,7 @@ this guide will be specific about which are strictly necessary.
|
|
7
7
|
|
8
8
|
== Require Sequel
|
9
9
|
|
10
|
-
This is sort of a no
|
10
|
+
This is sort of a no-brainer, but you need to require the library
|
11
11
|
first. This is a strict requirement, none of the other code can
|
12
12
|
be executed unless the library has been required first. Example:
|
13
13
|
|
@@ -70,7 +70,7 @@ copied into the subclass when model subclasses are created. Example:
|
|
70
70
|
== Load Model Classes
|
71
71
|
|
72
72
|
After you have established a database connection, and configured your
|
73
|
-
global model
|
73
|
+
global model configuration and global plugins, you can load your model
|
74
74
|
classes. It's recommended to have a separate file for each model class,
|
75
75
|
unless the model classes are very simple. Example:
|
76
76
|
|
@@ -91,6 +91,16 @@ unsafe runtime modification of the configuration:
|
|
91
91
|
model_classes.each(&:freeze)
|
92
92
|
DB.freeze
|
93
93
|
|
94
|
+
The `subclasses` plugin can be used to keep track of all model classes
|
95
|
+
that have been setup in your application. Finalizing their associations
|
96
|
+
and freezing them can easily be achieved through the plugin:
|
97
|
+
|
98
|
+
# Register the plugin before setting up the models
|
99
|
+
Sequel::Model.plugin :subclasses
|
100
|
+
# ... setup models
|
101
|
+
# Now finalize associations & freeze models by calling the plugin:
|
102
|
+
Sequel::Model.freeze_descendents
|
103
|
+
|
94
104
|
== Disconnect If Using Forking Webserver with Code Preloading
|
95
105
|
|
96
106
|
If you are using a forking webserver such as unicorn or passenger, with
|
data/doc/dataset_filtering.rdoc
CHANGED
@@ -36,8 +36,8 @@ Ranges (both inclusive and exclusive) can also be used:
|
|
36
36
|
|
37
37
|
If you need to select multiple items from a dataset, you can supply an array:
|
38
38
|
|
39
|
-
|
40
|
-
|
39
|
+
items.where(id: [1, 38, 47, 99]).sql
|
40
|
+
# "SELECT * FROM items WHERE (id IN (1, 38, 47, 99))"
|
41
41
|
|
42
42
|
== Filtering using expressions
|
43
43
|
|
@@ -4,7 +4,7 @@ How you design your model dataset methods can significantly affect the flexibili
|
|
4
4
|
|
5
5
|
== Flexibility: Use Single Method Per Task
|
6
6
|
|
7
|
-
In general, it is recommended that you have a single method per task for maximum
|
7
|
+
In general, it is recommended that you have a single method per task for maximum flexibility. For example, let's say you need to retrieve all albums released in a given year, ordered by number of units sold descending, and only care about the id, name and number of units sold. One way to do this is in your application code (outside the model), you can
|
8
8
|
call the dataset methods directly:
|
9
9
|
|
10
10
|
Album.
|
data/doc/model_plugins.rdoc
CHANGED
@@ -212,7 +212,7 @@ In general you should only require plugin arguments if you absolutely must have
|
|
212
212
|
|
213
213
|
== Handling Subclasses
|
214
214
|
|
215
|
-
Sequel::Model uses a copy-on-subclassing approach to model state. So instead of model
|
215
|
+
Sequel::Model uses a copy-on-subclassing approach to model state. So instead of having a model subclass ask its superclass for a value if the subclass don't have the value defined, the value should be copied from the parent class to the subclass when the subclass is created. While this can be implemented by overriding the +inherited+ class method, there is an available shortcut that handles most cases:
|
216
216
|
|
217
217
|
module Sequel::Plugins::Foo
|
218
218
|
module ClassMethods
|
@@ -0,0 +1,46 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* A fiber_concurrency extension has been added, for using
|
4
|
+
Fiber.current instead of Thread.current when checking out a
|
5
|
+
connection. This allows separate fibers of the same thread
|
6
|
+
to use separate connections. In addition to allowing direct use
|
7
|
+
of fibers, this also allows concurrent use of multiple enumerators
|
8
|
+
that use database connections in the same thread.
|
9
|
+
|
10
|
+
When using this extension, you must be careful and ensure that you
|
11
|
+
are not using more concurrent fibers than your connection pool size.
|
12
|
+
Otherwise, all fibers will block while one fiber waits until a
|
13
|
+
connection is available. It is possible this issue will be
|
14
|
+
addressed when Ruby implements a fiber scheduler (currently
|
15
|
+
being discussed for inclusion in Ruby 3).
|
16
|
+
|
17
|
+
* A run_transaction_hooks Database extension has been added,
|
18
|
+
allowing for running the transaction hooks before commit/rollback,
|
19
|
+
which can be helpful for testing the hooks when using transactional
|
20
|
+
testing.
|
21
|
+
|
22
|
+
= Other Improvements
|
23
|
+
|
24
|
+
* Database#create_table? now works correctly with the :partition_of
|
25
|
+
option on PostgreSQL.
|
26
|
+
|
27
|
+
* The timestamp(N) with time zone type is now recognized by the
|
28
|
+
schema parser.
|
29
|
+
|
30
|
+
* Singleton methods of the Sequel module have now been moved into a
|
31
|
+
Sequel::SequelMethods module. This allows you to extend Sequel
|
32
|
+
with a module that overrides the methods and call super to get
|
33
|
+
the default behavior.
|
34
|
+
|
35
|
+
* The pg_inet extension no longer defines inet/cidr conversion procs
|
36
|
+
if sequel_pg 1.13.0+ is in use. This is because sequel_pg 1.13.0+
|
37
|
+
will respect the conversion procs and defining them makes things
|
38
|
+
slower. sequel_pg 1.13.0+ handles the same conversion by default
|
39
|
+
without needing a conversion proc.
|
40
|
+
|
41
|
+
* Method visibility issues in the model, plugin, extension, and adapter
|
42
|
+
code have been fixed. Most cases fixed were private methods being
|
43
|
+
accidentally made public when they were overridden.
|
44
|
+
|
45
|
+
During this change, Model#_insert_values was changed from public to
|
46
|
+
private, since it was originally intended to be private.
|
@@ -0,0 +1,24 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* Custom join types are now supported on a per-association basis when
|
4
|
+
using eager_graph/association_join. This builds on the previous
|
5
|
+
support for custom aliases, using Sequel::SQL::AliasedExpression:
|
6
|
+
|
7
|
+
class Artist < Sequel::Model; end
|
8
|
+
class Album < Sequel::Model; end
|
9
|
+
class Track < Sequel::Model; end
|
10
|
+
Artist.one_to_many :albums
|
11
|
+
Album.one_to_many :tracks
|
12
|
+
Artist.eager_graph(
|
13
|
+
Sequel[:albums].as(:a, join_type: :inner) =>
|
14
|
+
Sequel[:tracks].as(:t, join_type: :left)
|
15
|
+
)
|
16
|
+
|
17
|
+
* A Database#current_timestamp_utc accessor has been added on SQLite.
|
18
|
+
Setting this to true will keep CURRENT_TIMESTAMP, CURRENT_TIME, and
|
19
|
+
CURRENT_DATE in UTC instead of converting them to localtime.
|
20
|
+
|
21
|
+
= Other Improvements
|
22
|
+
|
23
|
+
* The smallserial PostgreSQL type is now recognized and Sequel will
|
24
|
+
not try to mark smallserial columns as identity columns.
|
@@ -0,0 +1,40 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* The association_pks plugin now creates *_pks_dataset methods for
|
4
|
+
each association. These are similar to the existing *_pks getter
|
5
|
+
methods, but they return a dataset of the keys instead of the keys
|
6
|
+
themselves.
|
7
|
+
|
8
|
+
* The association_pks plugin now supports a :cache_pks association
|
9
|
+
option, which will cache calls to the *_pks getter method. The
|
10
|
+
default behavior remains that the *_pks getter method only returns
|
11
|
+
cached values if the *_pks= setter method has been used to set the
|
12
|
+
values.
|
13
|
+
|
14
|
+
* The *_pks getter methods supported by the association_pks plugin
|
15
|
+
now support a :refresh option to ignore any cached values, similar
|
16
|
+
to how the association getter methods work.
|
17
|
+
|
18
|
+
= Other Improvements
|
19
|
+
|
20
|
+
* If trying to disconnect a server that doesn't exist when using a
|
21
|
+
sharded connection pool, a Sequel::Error is now raised. Previously,
|
22
|
+
the sharded threaded pool raised a NoMethodError and the sharded
|
23
|
+
single connection pool did not raise an error.
|
24
|
+
|
25
|
+
* If using the :savepoint option when savepoints are not supported,
|
26
|
+
a Sequel::InvalidOperation exception is now raised, instead of a
|
27
|
+
NoMethodError.
|
28
|
+
|
29
|
+
* Calling Dataset#eager_graph with no arguments now returns the
|
30
|
+
dataset.
|
31
|
+
|
32
|
+
* If not connected to the database, the single connection pool will
|
33
|
+
not yield any connections to Database#pool.all_connections.
|
34
|
+
|
35
|
+
* Forcing a :ruby eager limit strategy for an association without a
|
36
|
+
limit or offset now works correctly.
|
37
|
+
|
38
|
+
* Multiple unnecessary conditionals have been removed.
|
39
|
+
|
40
|
+
* Sequel core and model code now have 100% branch coverage.
|
@@ -0,0 +1,56 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* An instance_specific_default plugin has been added for setting the
|
4
|
+
default for the :instance_specific association option, or
|
5
|
+
warning/raises in cases where it is not specified. This allows
|
6
|
+
you to easily find associations that would be considering instance
|
7
|
+
specific by default, and mark them as not instance specific for
|
8
|
+
better performance.
|
9
|
+
|
10
|
+
= Other Improvements
|
11
|
+
|
12
|
+
* Setting the :instance_specific association option to false now
|
13
|
+
works correctly if the association uses a block. Associations
|
14
|
+
that set the :dataset option are now always considered instance
|
15
|
+
specific, even if the :instance_specific option is explicitly
|
16
|
+
passed.
|
17
|
+
|
18
|
+
* The validation_class_methods plugin now considers all :if,
|
19
|
+
:allow_missing, :allow_nil, and :allow_blank options. Previously,
|
20
|
+
it only considered the first of those options that was set.
|
21
|
+
|
22
|
+
* Model.finalize_associations no longer breaks if you have
|
23
|
+
instance-specific associations.
|
24
|
+
|
25
|
+
* Model.plugin now warns if you load the plugin with arguments or a
|
26
|
+
block if the plugin does not accept arguments or block. This is
|
27
|
+
because a future change to Sequel could break the call.
|
28
|
+
|
29
|
+
* When emulating unsupported alter table operations on SQLite, Sequel
|
30
|
+
now copies composite unique constraints unless the alter table
|
31
|
+
operation is the dropping of a unique constraint.
|
32
|
+
|
33
|
+
* Sequel now recognizes an additional disconnect error in the oracle
|
34
|
+
adapter.
|
35
|
+
|
36
|
+
* In the run_transaction_hooks extension, calling
|
37
|
+
run_after_{commit,rollback}_hooks now raises the correct exception
|
38
|
+
class.
|
39
|
+
|
40
|
+
* In the pg_range extension, conversion procs for the tsrange[] and
|
41
|
+
tstzrange[] types are not added unless the Database uses the
|
42
|
+
pg_array extension.
|
43
|
+
|
44
|
+
* Multiple unnecessary conditionals in plugins and extensions have
|
45
|
+
been removed.
|
46
|
+
|
47
|
+
* Sequel plugin and extension code now have 100% branch coverage.
|
48
|
+
|
49
|
+
* Sequel now avoids a statement not reached verbose warning in
|
50
|
+
Dataset#clone.
|
51
|
+
|
52
|
+
= Backwards Compatibility
|
53
|
+
|
54
|
+
* The output of Dataset#to_dot in the to_dot extension has changed
|
55
|
+
slightly, including hash entries with nil keys. These entries
|
56
|
+
were previously ignored.
|
@@ -0,0 +1,60 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* Dataset#with_ties has been added on PostgreSQL 13+ and Microsoft
|
4
|
+
SQL Server, which will have a limited dataset also return all
|
5
|
+
rows with the same order as the final row.
|
6
|
+
|
7
|
+
* In the pg_json_ops extension, the following methods have been
|
8
|
+
added to Postgres::JSONBOp, all of which require PostgreSQL 13+:
|
9
|
+
|
10
|
+
* #set_lax
|
11
|
+
* #path_exists_tz!
|
12
|
+
* #path_match_tz!
|
13
|
+
* #path_query_tz
|
14
|
+
* #path_query_array_tz
|
15
|
+
* #path_query_first_tz
|
16
|
+
|
17
|
+
* On Oracle, the Database#view_exists? method now accepts a
|
18
|
+
:current_schema option to limit the views returned to the
|
19
|
+
current schema, instead of all non-system schemas.
|
20
|
+
|
21
|
+
= Other Improvements
|
22
|
+
|
23
|
+
* Sequel will now pass keyword arguments through in the following
|
24
|
+
cases:
|
25
|
+
|
26
|
+
* When loading plugins (Model.plugin)
|
27
|
+
|
28
|
+
* Class methods automically defined for methods defined in a
|
29
|
+
Model.dataset_module block
|
30
|
+
|
31
|
+
* Methods defined by Plugins.def_dataset_method
|
32
|
+
|
33
|
+
* Database methods called inside migrations
|
34
|
+
|
35
|
+
* Methods called via an association proxy when using the
|
36
|
+
association_proxies plugin.
|
37
|
+
|
38
|
+
* Dataset methods called inside a Dataset#query block when using
|
39
|
+
the query extension.
|
40
|
+
|
41
|
+
Previously, keywords were not handled in these cases, which would
|
42
|
+
cause deprecation warnings in Ruby 2.7 and ArgumentErrors in Ruby
|
43
|
+
3.0. Note that Sequel itself does not use keyword arguments at
|
44
|
+
all, so all of these changes only affect cases where external
|
45
|
+
methods are defined that accept keywords, and Sequel methods are
|
46
|
+
called with keywords that end up being delegated to the external
|
47
|
+
methods.
|
48
|
+
|
49
|
+
* The odbc adapter will now stream result sets instead of loading
|
50
|
+
the entire result set in memory and then iterating over it.
|
51
|
+
|
52
|
+
* Sequel now recognizes another disconnect error in the mysql and
|
53
|
+
mysql2 adapters.
|
54
|
+
|
55
|
+
= Backwards Compatibility
|
56
|
+
|
57
|
+
* Due to the odbc adapter change to use streaming, issuing queries
|
58
|
+
inside a Dataset#each block will no longer work unless a different
|
59
|
+
shard or thread is used. The behavior of such code is considered
|
60
|
+
undefined on all Sequel adapters.
|