sequel 5.68.0 → 5.77.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +134 -0
- data/README.rdoc +3 -3
- data/doc/mass_assignment.rdoc +1 -1
- data/doc/migration.rdoc +15 -0
- data/doc/opening_databases.rdoc +12 -3
- data/doc/release_notes/5.69.0.txt +26 -0
- data/doc/release_notes/5.70.0.txt +35 -0
- data/doc/release_notes/5.71.0.txt +21 -0
- data/doc/release_notes/5.72.0.txt +33 -0
- data/doc/release_notes/5.73.0.txt +66 -0
- data/doc/release_notes/5.74.0.txt +45 -0
- data/doc/release_notes/5.75.0.txt +35 -0
- data/doc/release_notes/5.76.0.txt +86 -0
- data/doc/release_notes/5.77.0.txt +63 -0
- data/doc/sharding.rdoc +3 -1
- data/doc/testing.rdoc +4 -2
- data/lib/sequel/adapters/ibmdb.rb +1 -1
- data/lib/sequel/adapters/jdbc/h2.rb +3 -0
- data/lib/sequel/adapters/jdbc/hsqldb.rb +2 -0
- data/lib/sequel/adapters/jdbc/postgresql.rb +3 -0
- data/lib/sequel/adapters/jdbc/sqlanywhere.rb +15 -0
- data/lib/sequel/adapters/jdbc/sqlserver.rb +4 -0
- data/lib/sequel/adapters/jdbc.rb +10 -6
- data/lib/sequel/adapters/mysql.rb +19 -7
- data/lib/sequel/adapters/mysql2.rb +2 -2
- data/lib/sequel/adapters/odbc/mssql.rb +1 -1
- data/lib/sequel/adapters/postgres.rb +6 -5
- data/lib/sequel/adapters/shared/db2.rb +12 -0
- data/lib/sequel/adapters/shared/mssql.rb +1 -1
- data/lib/sequel/adapters/shared/mysql.rb +31 -1
- data/lib/sequel/adapters/shared/oracle.rb +4 -6
- data/lib/sequel/adapters/shared/postgres.rb +79 -4
- data/lib/sequel/adapters/shared/sqlanywhere.rb +10 -4
- data/lib/sequel/adapters/shared/sqlite.rb +20 -3
- data/lib/sequel/adapters/sqlite.rb +42 -3
- data/lib/sequel/adapters/trilogy.rb +117 -0
- data/lib/sequel/connection_pool/sharded_threaded.rb +11 -10
- data/lib/sequel/connection_pool/sharded_timed_queue.rb +374 -0
- data/lib/sequel/connection_pool/threaded.rb +6 -0
- data/lib/sequel/connection_pool/timed_queue.rb +16 -3
- data/lib/sequel/connection_pool.rb +10 -1
- data/lib/sequel/database/connecting.rb +1 -1
- data/lib/sequel/database/misc.rb +2 -2
- data/lib/sequel/database/schema_methods.rb +9 -2
- data/lib/sequel/database/transactions.rb +6 -0
- data/lib/sequel/dataset/actions.rb +8 -6
- data/lib/sequel/dataset/features.rb +10 -1
- data/lib/sequel/dataset/sql.rb +47 -34
- data/lib/sequel/extensions/any_not_empty.rb +2 -2
- data/lib/sequel/extensions/async_thread_pool.rb +3 -2
- data/lib/sequel/extensions/auto_cast_date_and_time.rb +94 -0
- data/lib/sequel/extensions/connection_expiration.rb +15 -9
- data/lib/sequel/extensions/connection_validator.rb +15 -10
- data/lib/sequel/extensions/duplicate_columns_handler.rb +10 -9
- data/lib/sequel/extensions/index_caching.rb +5 -1
- data/lib/sequel/extensions/migration.rb +52 -13
- data/lib/sequel/extensions/named_timezones.rb +1 -1
- data/lib/sequel/extensions/pg_array.rb +10 -0
- data/lib/sequel/extensions/pg_auto_parameterize_in_array.rb +110 -0
- data/lib/sequel/extensions/pg_extended_date_support.rb +4 -4
- data/lib/sequel/extensions/pg_json_ops.rb +52 -0
- data/lib/sequel/extensions/pg_range.rb +2 -2
- data/lib/sequel/extensions/pg_timestamptz.rb +27 -3
- data/lib/sequel/extensions/round_timestamps.rb +1 -1
- data/lib/sequel/extensions/schema_caching.rb +1 -1
- data/lib/sequel/extensions/server_block.rb +2 -1
- data/lib/sequel/extensions/transaction_connection_validator.rb +78 -0
- data/lib/sequel/model/associations.rb +9 -2
- data/lib/sequel/model/base.rb +25 -12
- data/lib/sequel/model/dataset_module.rb +3 -0
- data/lib/sequel/model/exceptions.rb +15 -3
- data/lib/sequel/plugins/column_encryption.rb +27 -6
- data/lib/sequel/plugins/defaults_setter.rb +16 -0
- data/lib/sequel/plugins/list.rb +5 -2
- data/lib/sequel/plugins/mssql_optimistic_locking.rb +8 -38
- data/lib/sequel/plugins/optimistic_locking.rb +9 -42
- data/lib/sequel/plugins/optimistic_locking_base.rb +55 -0
- data/lib/sequel/plugins/paged_operations.rb +181 -0
- data/lib/sequel/plugins/pg_auto_constraint_validations.rb +5 -1
- data/lib/sequel/plugins/pg_xmin_optimistic_locking.rb +109 -0
- data/lib/sequel/plugins/rcte_tree.rb +7 -4
- data/lib/sequel/plugins/static_cache.rb +38 -0
- data/lib/sequel/plugins/static_cache_cache.rb +5 -1
- data/lib/sequel/plugins/validation_helpers.rb +1 -1
- data/lib/sequel/version.rb +1 -1
- metadata +43 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9951772dd3785c8ce91090bd31034a1e57ac5dcbc17af774b980a115cea15347
|
4
|
+
data.tar.gz: 3cfcaefaf6aa4758ef2cfaf78cbe6ccdc688e8b3836718bd63c42c5bdb220026
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0885577c11fd7285a5278d0a1b52ae411e557cec7bce2f3a49f8128a0be63928ebfa55b2b1a86c8b28ee1c3782c1dc5ebf5d4ecf00f0194ad33da89cb6ffc12a'
|
7
|
+
data.tar.gz: ccc7b8b6c68049ee1fed2211a3d193157ee36fde9c340324eba2a8cebd8925bc97b4dc1777b61f8a2fb94d83439c41f33afb832c080f4d54bab16d09924a4fe2
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,137 @@
|
|
1
|
+
=== 5.77.0 (2024-02-01)
|
2
|
+
|
3
|
+
* Support create_table :without_rowid option on SQLite (loranger32) (#2126)
|
4
|
+
|
5
|
+
* Warn by default if trying to eager_graph/association_join an association that uses a block, when the block would be ignored (jeremyevans)
|
6
|
+
|
7
|
+
* Speed up validates_unique in validation_helpers plugin by using empty? instead of count == 0 (numbata) (#2122)
|
8
|
+
|
9
|
+
* Speed up regexp matches in sqlite adapter on Ruby 2.4+ (jeremyevans)
|
10
|
+
|
11
|
+
* Add sqlite adapter :regexp_function_cache option for specifying the cache object to use (paddor, jeremyevans) (#2116)
|
12
|
+
|
13
|
+
* Respect list plugin :top option when inserting the first row into the model's table (johanmagnusson) (#2115)
|
14
|
+
|
15
|
+
* Switch default connection pool to timed_queue on Ruby 3.4+ (jeremyevans)
|
16
|
+
|
17
|
+
* Support on_duplicate_columns={raise,warn} parameter in connection URL when using duplicate_columns_handler extension (jeremyevans)
|
18
|
+
|
19
|
+
* Add transaction_connection_validator extension for retrying transactions on new connection if ther is a disconnect error when starting transaction (jeremyevans)
|
20
|
+
|
21
|
+
=== 5.76.0 (2024-01-01)
|
22
|
+
|
23
|
+
* Improve performance and flexibility of regexp matching in sqlite adapter (paddor) (#2108)
|
24
|
+
|
25
|
+
* Support SQL::Identifier for Database#tables :schema option values on PostgreSQL (jeremyevans)
|
26
|
+
|
27
|
+
* Support generating rcte queries using UNION or UNION ALL in the rcte plugin (jonathanfrias) (#2107)
|
28
|
+
|
29
|
+
* Make Database#table_exists? on PostgreSQL handle lock or statement timeout errors as evidence the table exists (jeremyevans) (#2106)
|
30
|
+
|
31
|
+
* Work around DateTime.jd fractional second bug on JRuby in named_timezones extension (jeremyevans)
|
32
|
+
|
33
|
+
* Support fractional times and timestamps on SQLAnywhere (jeremyevans)
|
34
|
+
|
35
|
+
* Make round_timestamps extension use Dataset#sqltime_precision for rounding Sequel::SQLTime values (jeremyevans)
|
36
|
+
|
37
|
+
* Remove special handling of %N modifier in Dataset#default_timestamp_format (jeremyevans)
|
38
|
+
|
39
|
+
* Add Dataset#default_time_format private method, for adapters to override for time (not timestamp) formatting (jeremyevans)
|
40
|
+
|
41
|
+
* Remove Dataset#format_timestamp_offset private method (jeremyevans)
|
42
|
+
|
43
|
+
* Remove special handling of %z modifier in Dataset#default_timestamp_format (jeremyevans)
|
44
|
+
|
45
|
+
* Add Dataset#literal_date_or_time, for simpler use by bound argument code (jeremyevans)
|
46
|
+
|
47
|
+
* Add auto_cast_date_and_time extension, for casting date and time values using SQL standard functions (jeremyevans)
|
48
|
+
|
49
|
+
=== 5.75.0 (2023-12-01)
|
50
|
+
|
51
|
+
* Make any_not_empty? extension support passing pattern argument to any? (jeremyevans) (#2100)
|
52
|
+
|
53
|
+
* Respect :skip_transaction option in PostgreSQL Dataset#paged_each (jeremyevans) (#2097)
|
54
|
+
|
55
|
+
* Add TimestampMigrator.run_single to run a single migration file up or down (opya, jeremyevans) (#2093)
|
56
|
+
|
57
|
+
* Support INSERT RETURNING on MariaDB 10.5+, and use it when saving new model objects (jeremyevans)
|
58
|
+
|
59
|
+
* Add Database#{defer,immediate}_constraints on PostgreSQL for changing handling of deferrable constraints in a transaction (jeremyevans)
|
60
|
+
|
61
|
+
=== 5.74.0 (2023-11-01)
|
62
|
+
|
63
|
+
* Make generated columns show up in Database#schema when using SQLite 3.37+ (jeremyevans) (#2087)
|
64
|
+
|
65
|
+
* Add revert method for Sequel.migration blocks, to revert changes inside the block on up, and apply the changes on down (jeremyevans)
|
66
|
+
|
67
|
+
* Re-add is_json and is_not_json methods to the pg_json_ops extension, as the support was re-added in PostgreSQL 16 (jeremyevans)
|
68
|
+
|
69
|
+
* Avoid infinite loop when handling exceptions with a cause loop in jdbc adapter (jeremyevans)
|
70
|
+
|
71
|
+
=== 5.73.0 (2023-10-01)
|
72
|
+
|
73
|
+
* Handle disconnect errors in ibmdb and jdbc/db2 adapters (jeremyevans) (#2083)
|
74
|
+
|
75
|
+
* Support skipping transactions in Dataset#{import,paged_each} using :skip_transaction option (jeremyevans)
|
76
|
+
|
77
|
+
* Add Database#transaction :skip_transaction option to skip creating a transaction or savepoint (jeremyevans)
|
78
|
+
|
79
|
+
* Stop using a transaction for a single query if calling Dataset#import with a dataset (jeremyevans)
|
80
|
+
|
81
|
+
* Add paged_operations plugin for paged deletes and updates and other custom operations (jeremyevans) (#2080)
|
82
|
+
|
83
|
+
* Support to_tsquery: :websearch option to Dataset#full_text_search on PostgreSQL 11+ (jeremyevans) (#2075)
|
84
|
+
|
85
|
+
* Add MassAssignmentRestriction#model and #column for getting the model instance and related column for mass assignment errors (artofhuman, jeremyevans) (#2079)
|
86
|
+
|
87
|
+
* Stop using base64 library in column_encryption plugin (jeremyevans)
|
88
|
+
|
89
|
+
=== 5.72.0 (2023-09-01)
|
90
|
+
|
91
|
+
* Sort caches before marshalling when using schema_caching, index_caching, static_cache_cache, and pg_auto_constraint_validations (jeremyevans)
|
92
|
+
|
93
|
+
* Change the defaults_setter plugin do a deep-copy of database default hash/array values and delegates (jeremyevans) (#2069)
|
94
|
+
|
95
|
+
* Add pg_auto_parameterize_in_array extension, for converting IN/NOT IN to = ANY or != ALL for more types (jeremyevans)
|
96
|
+
|
97
|
+
* Fix literalization of infinite and NaN float values in PostgreSQL array bound variables (jeremyevans)
|
98
|
+
|
99
|
+
=== 5.71.0 (2023-08-01)
|
100
|
+
|
101
|
+
* Support ILIKE ANY on PostgreSQL by not forcing the use of ESCAPE for ILIKE (gilesbowkett) (#2066)
|
102
|
+
|
103
|
+
* Add pg_xmin_optimistic_locking plugin for optimistic locking for all models without database changes (jeremyevans)
|
104
|
+
|
105
|
+
* Recognize the xid PostgreSQL type as an integer type in the jdbc/postgresql adapter (jeremyevans)
|
106
|
+
|
107
|
+
* Make set_column_allow_null method reversible in migrations (enescakir) (#2060)
|
108
|
+
|
109
|
+
=== 5.70.0 (2023-07-01)
|
110
|
+
|
111
|
+
* Make static_cache plugin better handle cases where forbid_lazy_load plugin is already loaded (jeremyevans)
|
112
|
+
|
113
|
+
* Fix ShardedThreadedConnectionPool#remove_server to disconnect all connections if removing multiple servers (jeremyevans)
|
114
|
+
|
115
|
+
* Support SEQUEL_DEFAULT_CONNECTION_POOL environment variable for choosing connection pool when :pool_class Database option is not set (jeremyevans)
|
116
|
+
|
117
|
+
* Add sharded_timed_queue connection pool (jeremyevans)
|
118
|
+
|
119
|
+
* Make connection_{validator,expiration} and async_thread_pool extensions work with timed_queue connection pool (jeremyevans)
|
120
|
+
|
121
|
+
* Make connection_{validator,expiration} extensions raise error when used with single threaded pools (HoneyryderChuck, jeremyevans) (#2049)
|
122
|
+
|
123
|
+
* Workaround possible resource starvation in threaded connection pool (ioquatix) (#2048)
|
124
|
+
|
125
|
+
=== 5.69.0 (2023-06-01)
|
126
|
+
|
127
|
+
* Avoid unsupported flag warning when using the mysql adapter with ruby-mysql 3+ (jeremyevans)
|
128
|
+
|
129
|
+
* Make mysql adapter work with ruby-mysql 4+ (jeremyevans)
|
130
|
+
|
131
|
+
* Add Model::DatasetModule#model accessor (davekaro) (#2040)
|
132
|
+
|
133
|
+
* Add trilogy adapter (jeremyevans)
|
134
|
+
|
1
135
|
=== 5.68.0 (2023-05-01)
|
2
136
|
|
3
137
|
* Add validation_helpers_generic_type_messages plugin for more useful type validation failure messages (jeremyevans) (#2028)
|
data/README.rdoc
CHANGED
@@ -13,7 +13,7 @@ toolkit for Ruby.
|
|
13
13
|
database sharding.
|
14
14
|
* Sequel currently has adapters for ADO, Amalgalite,
|
15
15
|
IBM_DB, JDBC, MySQL, Mysql2, ODBC, Oracle,
|
16
|
-
PostgreSQL, SQLAnywhere, SQLite3, and
|
16
|
+
PostgreSQL, SQLAnywhere, SQLite3, TinyTDS, and Trilogy.
|
17
17
|
|
18
18
|
== Resources
|
19
19
|
|
@@ -825,7 +825,7 @@ You can dynamically customize eager loads for both +eager+ and +eager_graph+ whi
|
|
825
825
|
|
826
826
|
=== Joining with Associations
|
827
827
|
|
828
|
-
You can use the +association_join+ method to add a join to the model's dataset based on the
|
828
|
+
You can use the +association_join+ method to add a join to the model's dataset based on the association:
|
829
829
|
|
830
830
|
Post.association_join(:author)
|
831
831
|
# SELECT * FROM posts
|
@@ -927,7 +927,7 @@ Sequel fully supports the currently supported versions of Ruby (MRI) and JRuby.
|
|
927
927
|
support unsupported versions of Ruby or JRuby, but such support may be dropped in any
|
928
928
|
minor version if keeping it becomes a support issue. The minimum Ruby version
|
929
929
|
required to run the current version of Sequel is 1.9.2, and the minimum JRuby version is
|
930
|
-
9.
|
930
|
+
9.2.0.0 (due to the bigdecimal dependency).
|
931
931
|
|
932
932
|
== Maintainer
|
933
933
|
|
data/doc/mass_assignment.rdoc
CHANGED
@@ -48,7 +48,7 @@ If you want to change mass assignment so it ignores attempts to access restricte
|
|
48
48
|
Since mass assignment by default allows modification of all column values except for primary key columns, it can be a security risk in some cases.
|
49
49
|
If you are dealing with untrusted input, you are generally going to want to restrict what should be updated.
|
50
50
|
|
51
|
-
Sequel has <tt>Model#set_fields</tt> and <tt>Model#update_fields</tt> methods, which are designed to be used with
|
51
|
+
Sequel has <tt>Model#set_fields</tt> and <tt>Model#update_fields</tt> methods, which are designed to be used with untrusted input.
|
52
52
|
These methods take two arguments, the untrusted hash as the first argument, and a trusted array of field names as the second argument:
|
53
53
|
|
54
54
|
post.set_fields({title: 'T', body: 'B'}, [:title, :body])
|
data/doc/migration.rdoc
CHANGED
@@ -86,9 +86,24 @@ the following methods:
|
|
86
86
|
* +add_full_text_index+
|
87
87
|
* +add_spatial_index+
|
88
88
|
* +rename_column+
|
89
|
+
* +set_column_allow_null+
|
89
90
|
|
90
91
|
If you use any other methods, you should create your own +down+ block.
|
91
92
|
|
93
|
+
To revert a migration created with +change+, you can copy the migration to a new file, and
|
94
|
+
replace +change+ with +revert+. For example, if you no longer need the artists table, you
|
95
|
+
can use the following migration. This will drop the artists table when migrating up, and
|
96
|
+
recreate it when migrating down:
|
97
|
+
|
98
|
+
Sequel.migration do
|
99
|
+
revert do
|
100
|
+
create_table(:artists) do
|
101
|
+
primary_key :id
|
102
|
+
String :name, null: false
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
92
107
|
In normal usage, when Sequel's migrator runs, it runs the +up+ blocks for all
|
93
108
|
migrations that have not yet been applied. However, you can use the <tt>-M</tt>
|
94
109
|
switch to specify the version to which to migrate, and if it is lower than the
|
data/doc/opening_databases.rdoc
CHANGED
@@ -279,7 +279,7 @@ if either the :sslca or :sslkey option is given.
|
|
279
279
|
|
280
280
|
=== mysql2
|
281
281
|
|
282
|
-
This is a
|
282
|
+
This is a MySQL adapter that does typecasting in C, so it is often faster than the
|
283
283
|
mysql adapter. The options given are passed to Mysql2::Client.new, see the mysql2 documentation
|
284
284
|
for details on what options are supported. The :timeout, :auto_is_null, :sql_mode, and :disable_split_materialized
|
285
285
|
options supported by the mysql adapter are also supported for mysql2 adapter (and any other adapters connecting to
|
@@ -388,8 +388,10 @@ The following additional options are supported:
|
|
388
388
|
:readonly :: open database in read-only mode
|
389
389
|
:timeout :: the busy timeout to use in milliseconds (default: 5000).
|
390
390
|
:setup_regexp_function :: Whether to setup a REGEXP function in the underlying SQLite3::Database object. Doing so
|
391
|
-
allows you to use regexp support in dataset expressions.
|
392
|
-
|
391
|
+
allows you to use regexp support in dataset expressions. If +:cached+ or <tt>"cached"</tt>+, caches each
|
392
|
+
unique regex (more efficient but risk of memory leak). If a Proc is provided, it will be called with
|
393
|
+
a string for the regexp and a string for the value to compare, and should return whether the regexp
|
394
|
+
string matches the string value to compare. The default Proc used does <tt>Regexp.new(regexp_str).match(str)</tt>.
|
393
395
|
|
394
396
|
Note that SQLite memory databases are restricted to a single connection by
|
395
397
|
default. This is because SQLite does not allow multiple connections to
|
@@ -423,3 +425,10 @@ Other Sequel specific options:
|
|
423
425
|
This should be specified as an integer. If you plan on setting large
|
424
426
|
text or blob values via tinytds, you should use this option or modify
|
425
427
|
your freetds.conf file.
|
428
|
+
|
429
|
+
=== trilogy
|
430
|
+
|
431
|
+
This is a MySQL adapter that does typecasting in C, and does not require any mysql client libraries installed.
|
432
|
+
The options given are passed to Trilogy.new, see the trilogy documentation for details on what options are
|
433
|
+
supported. The :timeout, :auto_is_null, :sql_mode, and :disable_split_materialized
|
434
|
+
options supported by the mysql adapter are also supported for trilogy adapter.
|
@@ -0,0 +1,26 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* An adapter has been added for the trilogy MySQL driver. One large
|
4
|
+
advantage over mysql2 is that trilogy does not require any MySQL
|
5
|
+
client libraries installed on the machine. The trilogy adapter
|
6
|
+
has basically the same issues/skipped specs as the mysql2 adapter,
|
7
|
+
but it also does not support an application_timezone different
|
8
|
+
than the database_timezone.
|
9
|
+
|
10
|
+
* Model dataset modules now have a model accessor, allowing for
|
11
|
+
code such as:
|
12
|
+
|
13
|
+
class Foo < Sequel::Model
|
14
|
+
dataset_module do
|
15
|
+
where :kept, Sequel[model.table_name][:discarded_at] => nil
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
= Improvements
|
20
|
+
|
21
|
+
* The mysql adapter now works with ruby-mysql 4 (the pure-ruby
|
22
|
+
MySQL driver). Note that multi-results support does not work
|
23
|
+
with ruby-mysql 4 (it doesn't work with mysql2, trilogy, or
|
24
|
+
other Sequel adapters in general).
|
25
|
+
|
26
|
+
* Warnings for unsupported flags are now avoided on ruby-mysql 3.
|
@@ -0,0 +1,35 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* A sharded_timed_queue connection pool has been added. This offers
|
4
|
+
most of the same features as the sharded_threaded connection pool,
|
5
|
+
but uses the new Queue#pop :timeout features added in Ruby 3.2 to
|
6
|
+
allow for a simpler and possibly faster and more robust
|
7
|
+
implementation.
|
8
|
+
|
9
|
+
* If a :pool_class option is not specified when creating a Database,
|
10
|
+
Sequel will now look at the SEQUEL_DEFAULT_CONNECTION_POOL
|
11
|
+
environment variable to determine the connection pool class to use.
|
12
|
+
This allows you to set SEQUEL_DEFAULT_CONNECTION_POOL=timed_queue
|
13
|
+
on Ruby 3.2 to test with the timed_queue connection pool without
|
14
|
+
making any code changes. If the :servers Database option is given,
|
15
|
+
Sequel will automatically use the sharded version of the connection
|
16
|
+
pool specified by SEQUEL_DEFAULT_CONNECTION_POOL.
|
17
|
+
|
18
|
+
= Other Improvements
|
19
|
+
|
20
|
+
* The connection_validator, connection_expiration, and
|
21
|
+
async_thread_pool extensions now work with the timed_queue and
|
22
|
+
sharded_timed_queue connection pools.
|
23
|
+
|
24
|
+
* The sharded_threaded connection pool now disconnects connections
|
25
|
+
for all specified servers instead of just the last specified server
|
26
|
+
when using remove_server.
|
27
|
+
|
28
|
+
* The static_cache plugin now recognizes when the forbid_lazy_load
|
29
|
+
plugin is already loaded, and does not return instances that
|
30
|
+
forbid lazy load for methods that return a single object, such as
|
31
|
+
Database.{[],cache_get_pk,first}.
|
32
|
+
|
33
|
+
* Sequel now displays an informative error message if attempting to
|
34
|
+
load the connection_validator or connection_expiration extensions
|
35
|
+
when using the single threaded connection pool.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* A pg_xmin_optimistic_locking plugin has been added. This plugin
|
4
|
+
uses PostgreSQL's xmin system column to implement optimistic
|
5
|
+
locking. The xmin system column is automatically updated whenever
|
6
|
+
the database row is updated. You can load this plugin into a
|
7
|
+
base model and have all models that subclass from it use optimistic
|
8
|
+
locking, without needing any user-defined lock columns.
|
9
|
+
|
10
|
+
= Other Improvements
|
11
|
+
|
12
|
+
* set_column_allow_null is now a reversible migration method inside
|
13
|
+
alter_table blocks.
|
14
|
+
|
15
|
+
* The use of ILIKE no longer forces the ESCAPE clause on PostgreSQL,
|
16
|
+
which allows the use of ILIKE ANY and other constructions. There
|
17
|
+
is no need to use the ESCAPE clause with ILIKE, because the value
|
18
|
+
Sequel uses is PostgreSQL's default.
|
19
|
+
|
20
|
+
* The xid PostgreSQL type is now recognized as an integer type in the
|
21
|
+
jdbc/postgresql adapter.
|
@@ -0,0 +1,33 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* A pg_auto_parameterize_in_array extension has been added, which
|
4
|
+
handles conversion of IN/NOT IN to = ANY or != ALL for more types.
|
5
|
+
The pg_auto_parameterize extension only handles integer types by
|
6
|
+
default, because other types require the pg_array extension. This
|
7
|
+
new extension adds handling for Float, BigDecimal, Date, Time,
|
8
|
+
DateTime, Sequel::SQLTime, and Sequel::SQL::Blob types. It can
|
9
|
+
also handle String types if the :treat_string_list_as_text_array
|
10
|
+
Database option is present, using the text type for that. Handling
|
11
|
+
String values as text is not the default because that may cause
|
12
|
+
issues for some queries.
|
13
|
+
|
14
|
+
= Other Improvements
|
15
|
+
|
16
|
+
* The defaults_setter plugin now does a deep copy of database
|
17
|
+
default values that are hash/array or delegates to hash/array.
|
18
|
+
This fixes cases where the database default values are mutated.
|
19
|
+
|
20
|
+
* Sequel now correctly handles infinite and NaN float values used
|
21
|
+
inside PostgreSQL array bound variables.
|
22
|
+
|
23
|
+
* The data in the cache files used by the schema_caching and
|
24
|
+
index_caching extensions and static_cache_cache and
|
25
|
+
pg_auto_constraint_validations plugins are now sorted before the
|
26
|
+
cache file is saved, increasing consistency between runs.
|
27
|
+
|
28
|
+
* bigdecimal has been added as a dependency. bigdecimal is currently
|
29
|
+
a default gem in Ruby from 1.9 to 3.2, but it will move to a
|
30
|
+
bundled gem in Ruby 3.4, and there will be warnings in Ruby 3.3
|
31
|
+
for cases that will break in Ruby 3.4. Adding bigdecimal as a
|
32
|
+
dependency should avoid warnings when using bundler in Ruby 3.3,
|
33
|
+
and should avoid errors in Ruby 3.4.
|
@@ -0,0 +1,66 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* A paged_operations plugin has been added, which adds support for
|
4
|
+
paged_datasets, paged_update, and paged_delete dataset methods.
|
5
|
+
This methods are designed to be used on large datasets, to split
|
6
|
+
a large query into separate smaller queries, to avoid locking the
|
7
|
+
related database table for a long period of time.
|
8
|
+
paged_update and paged_delete operate the same as update and delete,
|
9
|
+
returning the number of rows updated or deleted. paged_datasets yields
|
10
|
+
one or more datasets representing subsets of the receiver, with the
|
11
|
+
union of all of those datasets comprising all records in the receiver:
|
12
|
+
|
13
|
+
Album.plugin :paged_operations
|
14
|
+
|
15
|
+
Album.where{name > 'M'}.paged_datasets{|ds| puts ds.sql}
|
16
|
+
# Runs: SELECT id FROM albums WHERE (name <= 'M') ORDER BY id LIMIT 1 OFFSET 1000
|
17
|
+
# Prints: SELECT * FROM albums WHERE ((name <= 'M') AND ("id" < 1002))
|
18
|
+
# Runs: SELECT id FROM albums WHERE ((name <= 'M') AND (id >= 1002)) ORDER BY id LIMIT 1 OFFSET 1000
|
19
|
+
# Prints: SELECT * FROM albums WHERE ((name <= 'M') AND ("id" < 2002) AND (id >= 1002))
|
20
|
+
# ...
|
21
|
+
# Runs: SELECT id FROM albums WHERE ((name <= 'M') AND (id >= 10002)) ORDER BY id LIMIT 1 OFFSET 1000
|
22
|
+
# Prints: SELECT * FROM albums WHERE ((name <= 'M') AND (id >= 10002))
|
23
|
+
|
24
|
+
Album.where{name <= 'M'}.paged_update(:updated_at=>Sequel::CURRENT_TIMESTAMP)
|
25
|
+
# SELECT id FROM albums WHERE (name <= 'M') ORDER BY id LIMIT 1 OFFSET 1000
|
26
|
+
# UPDATE albums SET updated_at = CURRENT_TIMESTAMP WHERE ((name <= 'M') AND ("id" < 1002))
|
27
|
+
# SELECT id FROM albums WHERE ((name <= 'M') AND (id >= 1002)) ORDER BY id LIMIT 1 OFFSET 1000
|
28
|
+
# UPDATE albums SET updated_at = CURRENT_TIMESTAMP WHERE ((name <= 'M') AND ("id" < 2002) AND (id >= 1002))
|
29
|
+
# ...
|
30
|
+
# SELECT id FROM albums WHERE ((name <= 'M') AND (id >= 10002)) ORDER BY id LIMIT 1 OFFSET 1000
|
31
|
+
# UPDATE albums SET updated_at = CURRENT_TIMESTAMP WHERE ((name <= 'M') AND (id >= 10002))
|
32
|
+
|
33
|
+
Album.where{name > 'M'}.paged_delete
|
34
|
+
# SELECT id FROM albums WHERE (name > 'M') ORDER BY id LIMIT 1 OFFSET 1000
|
35
|
+
# DELETE FROM albums WHERE ((name > 'M') AND (id < 1002))
|
36
|
+
# SELECT id FROM albums WHERE (name > 'M') ORDER BY id LIMIT 1 OFFSET 1000
|
37
|
+
# DELETE FROM albums WHERE ((name > 'M') AND (id < 2002))
|
38
|
+
# ...
|
39
|
+
# SELECT id FROM albums WHERE (name > 'M') ORDER BY id LIMIT 1 OFFSET 1000
|
40
|
+
# DELETE FROM albums WHERE (name > 'M')
|
41
|
+
|
42
|
+
* A Dataset#transaction :skip_transaction option is now support to
|
43
|
+
checkout a connection from the pool without opening a transaction. This
|
44
|
+
makes it easier to handle cases where a transaction may or not be used
|
45
|
+
based on configuration/options. Dataset#import and Dataset#paged_each
|
46
|
+
now both support the :skip_transaction option to skip transactions.
|
47
|
+
|
48
|
+
* Dataset#full_text_search now supports the to_tsquery: :websearch option
|
49
|
+
on PostgreSQL 11+, to use the websearch_to_tsquery database function.
|
50
|
+
|
51
|
+
* The Sequel::MassAssignmentRestriction exception now supports model
|
52
|
+
and column methods to get provide additional information about the
|
53
|
+
exception. Additionally, the exception message now includes information
|
54
|
+
about the model class.
|
55
|
+
|
56
|
+
= Other Improvements
|
57
|
+
|
58
|
+
* The ibmdb and jdbc/db2 adapter now both handle disconnect errors
|
59
|
+
correctly, removing the related connection from the pool.
|
60
|
+
|
61
|
+
* Dataset#import no longer uses an explicit transaction if given a dataset
|
62
|
+
value, as in that case, only a single query is used.
|
63
|
+
|
64
|
+
* The column_encryption plugin no longer uses the base64 library. The
|
65
|
+
base64 library is moving from the standard library to a bundled gem
|
66
|
+
in Ruby 3.4, and this avoids having a dependency on it.
|
@@ -0,0 +1,45 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* Sequel.migration blocks now support a revert method, which reverts
|
4
|
+
the changes in the block on up, and applies them on down. So if
|
5
|
+
you have a migration such as:
|
6
|
+
|
7
|
+
Sequel.migration do
|
8
|
+
change do
|
9
|
+
create_table :table do
|
10
|
+
# ...
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
and you later want to add a migration that drops the table, you
|
16
|
+
can use:
|
17
|
+
|
18
|
+
Sequel.migration do
|
19
|
+
revert do
|
20
|
+
create_table :table do
|
21
|
+
# ...
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
This will drop the table when migrating up, and create a table
|
27
|
+
with the given schema when migrating down.
|
28
|
+
|
29
|
+
* is_json and is_not_json methods have been added to the pg_json_ops
|
30
|
+
extension, for the IS [NOT] JSON operator supported in PostgreSQL
|
31
|
+
16+. These were previously added in Sequel 5.59.0, and removed
|
32
|
+
in Sequel 5.61.0 as support was removed in PostgreSQL 15 beta 4.
|
33
|
+
PostgreSQL 16 shipped with support for them, so support has been
|
34
|
+
recommitted to Sequel.
|
35
|
+
|
36
|
+
= Other Improvements
|
37
|
+
|
38
|
+
* SQLite generated columns now show up in Database#schema when using
|
39
|
+
SQLite 3.37+.
|
40
|
+
|
41
|
+
* Sequel now attempts to avoid an infinite loop in pathlogical cases
|
42
|
+
in the jdbc adapter, where the exception cause chain has a loop.
|
43
|
+
Additionally, if an exception is already recognized as a disconnect,
|
44
|
+
or an exception already responds to a getSQLState method, Sequel no
|
45
|
+
longer looks at the causes of the exception.
|
@@ -0,0 +1,35 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* Database#{defer,immediate}_constraints methods have been added on
|
4
|
+
PostgreSQL for changing handling of deferrable constraints inside
|
5
|
+
a transaction. defer_constraints sets deferrable constraints to
|
6
|
+
be deferred (not checked until transaction commit), and
|
7
|
+
immediate_constraints sets deferrable constraints to be checked
|
8
|
+
as part of the related query, and any already deferred constraint
|
9
|
+
checks to be applied immediately. You can pass the :constraints
|
10
|
+
option to only apply the changes to specific constraints.
|
11
|
+
|
12
|
+
* TimestampMigrator.run_single has been added, to migrate a single
|
13
|
+
migration up or down.
|
14
|
+
|
15
|
+
= Other Improvements
|
16
|
+
|
17
|
+
* INSERT RETURNING is now supported on MariaDB 10.5+, and used
|
18
|
+
automatically when saving new model objects. Note that this
|
19
|
+
is not supported when using the jdbc adapter, because the
|
20
|
+
jdbc-mysql driver doesn't support it. A jdbc/mariadb adapter
|
21
|
+
could be added, as it's likely recent versions of the
|
22
|
+
jdbc-mariadb driver would support it, but the jdbc-mariadb gem
|
23
|
+
hasn't been updated in over 4 years. Talk to the jdbc-mariadb
|
24
|
+
gem maintainers if you want to use this feature with the jdbc
|
25
|
+
adapter.
|
26
|
+
|
27
|
+
* The Dataset#paged_each optimization in the postgres adapter
|
28
|
+
now respects the :skip_transaction option, making it the
|
29
|
+
same as the :hold option. Note that this has effects beyond
|
30
|
+
just skipping the transaction, but non-HOLD cursors are only
|
31
|
+
supported inside transactions.
|
32
|
+
|
33
|
+
* The any_not_empty? extension's Dataset#any? method now supports
|
34
|
+
an argument, passing it to Enumerable#any? (which has supported
|
35
|
+
an argument since Ruby 2.5).
|
@@ -0,0 +1,86 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* An auto_cast_date_and_time extension has been added, which will
|
4
|
+
automatically cast date and time values using SQL standard functions.
|
5
|
+
This makes sure the database will treat the value as a date, time,
|
6
|
+
or timestamp, instead of treating it as a string or unknown type:
|
7
|
+
|
8
|
+
DB.get(Date.today).class
|
9
|
+
# SELECT '2024-01-01' AS v LIMIT 1
|
10
|
+
String
|
11
|
+
|
12
|
+
DB.extension(:auto_cast_date_and_time)
|
13
|
+
DB.get(Date.today).class
|
14
|
+
# SELECT DATE '2024-01-01' AS v LIMIT 1
|
15
|
+
Date
|
16
|
+
|
17
|
+
This was already Sequel's default behavior on adapters that required
|
18
|
+
it. This extension is usable on PostgreSQL and MySQL. It is not
|
19
|
+
usable on SQLite (no date/time types) or Microsoft SQL Server (no
|
20
|
+
support for the SQL standard conversion syntax).
|
21
|
+
|
22
|
+
This extension can break code that currently works. If using it on
|
23
|
+
PostgreSQL, it will cast the values to TIMESTAMP, not TIMESTAMP
|
24
|
+
WITH TIME ZONE, which can break code that depended on an implicit
|
25
|
+
conversion to TIMESTAMP WITH TIME ZONE. The pg_timestamptz
|
26
|
+
extension integrates with the the auto_cast_date_and_time extension
|
27
|
+
and will implicitly cast Time/DateTime to TIMESTAMP WITH TIME ZONE.
|
28
|
+
|
29
|
+
* The sqlite adapter now supports a :cached value for the
|
30
|
+
:setup_regexp_function Database option, which will cache regexp
|
31
|
+
values instead of creating a new regexp per value to compare. This
|
32
|
+
is much faster when using a regexp comparison on a large dataset,
|
33
|
+
but can result in a memory leak if using dynamic regexps. You can
|
34
|
+
also provide a Proc value for the :setup_regexp_function option,
|
35
|
+
which will be passed both the regexp source string and the database
|
36
|
+
string to compare, and should return whether the database string
|
37
|
+
matches the regexp string.
|
38
|
+
|
39
|
+
* The rcte_tree plugin now supports a :union_all option, which can
|
40
|
+
be set to false to use UNION instead of UNION ALL in the recursive
|
41
|
+
common table expression.
|
42
|
+
|
43
|
+
= Other Improvements
|
44
|
+
|
45
|
+
* Time/DateTime/SQLTime literalization speed has more than doubled
|
46
|
+
compared to the previous version. The internal code is also much
|
47
|
+
simpler, as the speedup resulted from removing multiple abstraction
|
48
|
+
layers that mostly existed for Ruby 1.8 support.
|
49
|
+
|
50
|
+
* Database#table_exists? on PostgreSQL now handles lock or statement
|
51
|
+
timeout errors as evidence the table exists.
|
52
|
+
|
53
|
+
* The round_timestamps extension now correctly rounds SQLTime values
|
54
|
+
on Microsoft SQL Server (the only database Sequel supports where
|
55
|
+
time precision is different than timestamp precision).
|
56
|
+
|
57
|
+
* Fractional times and timestamps are now supported on SQLAnywhere,
|
58
|
+
except for time values when using the jdbc adapter due to a
|
59
|
+
limitation in the JDBC sqlanywhere driver.
|
60
|
+
|
61
|
+
* Database#tables and #views on PostgreSQL now supports
|
62
|
+
SQL::Identifier values for the :schema option.
|
63
|
+
|
64
|
+
* The named_timezones extension now works around a bug in DateTime.jd
|
65
|
+
on JRuby.
|
66
|
+
|
67
|
+
= Backwards Compatibility
|
68
|
+
|
69
|
+
* Time/DateTime/SQLTime literalization internals have changed.
|
70
|
+
If you are using an external adapter and the external adapter
|
71
|
+
overrides or calls any of the following methods:
|
72
|
+
|
73
|
+
* requires_sql_standard_datetimes?
|
74
|
+
* supports_timestamp_usecs?
|
75
|
+
* supports_timestamp_timezones?
|
76
|
+
* timestamp_precision
|
77
|
+
* sqltime_precision
|
78
|
+
|
79
|
+
then the adapter may need to be updated to support Sequel 5.76.0.
|
80
|
+
Additionally, if the adapter uses %N or %z in
|
81
|
+
default_timestamp_format, it may need to be updated. Adapters
|
82
|
+
should now just override default_timestamp_format and/or
|
83
|
+
default_time_format methods as appropriate for the database.
|
84
|
+
|
85
|
+
* The Dataset#format_timestamp_offset private method has been
|
86
|
+
removed.
|
@@ -0,0 +1,63 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* A transaction_connection_validator extension has been added. This
|
4
|
+
extension allows for transparently switching to a new connection if
|
5
|
+
a disconnect error is raised while trying to start a transaction, as
|
6
|
+
long as a connection was not already checked out from the pool
|
7
|
+
when the transaction method was called. Transparent reconnection
|
8
|
+
is safe in this case, since no user code is retried.
|
9
|
+
|
10
|
+
This extension can have lower overhead than the
|
11
|
+
connection_validator extension if that is configured to check for
|
12
|
+
validity more often than the default of one hour. However, it
|
13
|
+
only handles cases where transactions are used. It can detect
|
14
|
+
disconnects that would not be detected by default with the
|
15
|
+
connection_validator extension, since that extension defaults to
|
16
|
+
only checking validity if the connection has not been used in the
|
17
|
+
last hour.
|
18
|
+
|
19
|
+
* Sequel now supports a create_table :without_rowid option on SQLite,
|
20
|
+
to create a table WITHOUT ROWID, for better performance in some
|
21
|
+
cases. Users are encouraged to read the SQLite documentation on
|
22
|
+
WITHOUT ROWID before using this option.
|
23
|
+
|
24
|
+
* The sqlite adapter now supports a :regexp_function_cache option, if
|
25
|
+
the :setup_regexp_function option is set to :cached. The
|
26
|
+
:regexp_function_cache option should be a Proc (returning a cache
|
27
|
+
object to use), or a class. It's possible to use
|
28
|
+
ObjectSpace::WeakKeyMap as the value of the option on Ruby 3.3+
|
29
|
+
to avoid the memory leaks that are possible when using
|
30
|
+
:setup_regexp_function option :cached value with dynamic regexps.
|
31
|
+
|
32
|
+
* The duplicate_columns_handler extension now supports specifying
|
33
|
+
the on_duplicate_columns option as a connection string parameter.
|
34
|
+
|
35
|
+
= Other Improvements
|
36
|
+
|
37
|
+
* The list plugin now honors the :top option for the position when
|
38
|
+
adding the first item to the list, instead of always using 1.
|
39
|
+
|
40
|
+
* Regexp matches on SQLite are now faster on Ruby 2.4+, using
|
41
|
+
Regexp#match?.
|
42
|
+
|
43
|
+
* The uniqueness validation in the validation_helpers plugin now
|
44
|
+
uses empty? instead of count == 0, for better performance.
|
45
|
+
|
46
|
+
* On Ruby 3.4+, Sequel uses the timed_queue connection pool instead
|
47
|
+
of the threaded connection pool by default. This should make it
|
48
|
+
so no existing applications are affected by the default switch.
|
49
|
+
This should hopefully allow ample testing of the timed_queue
|
50
|
+
connection pool. At some point in the future, if no problems
|
51
|
+
are repoted, Sequel will likely switch to using the timed_queue
|
52
|
+
connection pool by default on Ruby 3.2+.
|
53
|
+
|
54
|
+
= Backwards Compatibility
|
55
|
+
|
56
|
+
* Sequel now warns by default if using eager_graph/association_join
|
57
|
+
with an association that uses a block, in the cases where the
|
58
|
+
block would be ignored and there are no appropriate graph options
|
59
|
+
set. In Sequel 6, this warning will be turned into an exception.
|
60
|
+
It is recommended that users use the auto_restrict_eager_graph
|
61
|
+
plugin to turn this into an exception now, or use the
|
62
|
+
:graph_use_association_block option so that the block is not
|
63
|
+
ignored when graphing.
|