sequel 5.83.0 → 5.84.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sequel/adapters/shared/sqlite.rb +3 -1
- data/lib/sequel/database/connecting.rb +1 -1
- data/lib/sequel/database/misc.rb +8 -3
- data/lib/sequel/database/schema_methods.rb +2 -0
- data/lib/sequel/extensions/pg_json_ops.rb +328 -1
- data/lib/sequel/sql.rb +8 -5
- data/lib/sequel/version.rb +1 -1
- metadata +2 -236
- data/CHANGELOG +0 -1393
- data/README.rdoc +0 -936
- data/doc/advanced_associations.rdoc +0 -884
- data/doc/association_basics.rdoc +0 -1859
- data/doc/bin_sequel.rdoc +0 -146
- data/doc/cheat_sheet.rdoc +0 -255
- data/doc/code_order.rdoc +0 -104
- data/doc/core_extensions.rdoc +0 -405
- data/doc/dataset_basics.rdoc +0 -96
- data/doc/dataset_filtering.rdoc +0 -222
- data/doc/extensions.rdoc +0 -77
- data/doc/fork_safety.rdoc +0 -84
- data/doc/mass_assignment.rdoc +0 -98
- data/doc/migration.rdoc +0 -660
- data/doc/model_dataset_method_design.rdoc +0 -129
- data/doc/model_hooks.rdoc +0 -254
- data/doc/model_plugins.rdoc +0 -270
- data/doc/mssql_stored_procedures.rdoc +0 -43
- data/doc/object_model.rdoc +0 -563
- data/doc/opening_databases.rdoc +0 -439
- data/doc/postgresql.rdoc +0 -611
- data/doc/prepared_statements.rdoc +0 -144
- data/doc/querying.rdoc +0 -1070
- data/doc/reflection.rdoc +0 -120
- data/doc/release_notes/5.0.0.txt +0 -159
- data/doc/release_notes/5.1.0.txt +0 -31
- data/doc/release_notes/5.10.0.txt +0 -84
- data/doc/release_notes/5.11.0.txt +0 -83
- data/doc/release_notes/5.12.0.txt +0 -141
- data/doc/release_notes/5.13.0.txt +0 -27
- data/doc/release_notes/5.14.0.txt +0 -63
- data/doc/release_notes/5.15.0.txt +0 -39
- data/doc/release_notes/5.16.0.txt +0 -110
- data/doc/release_notes/5.17.0.txt +0 -31
- data/doc/release_notes/5.18.0.txt +0 -69
- data/doc/release_notes/5.19.0.txt +0 -28
- data/doc/release_notes/5.2.0.txt +0 -33
- data/doc/release_notes/5.20.0.txt +0 -89
- data/doc/release_notes/5.21.0.txt +0 -87
- data/doc/release_notes/5.22.0.txt +0 -48
- data/doc/release_notes/5.23.0.txt +0 -56
- data/doc/release_notes/5.24.0.txt +0 -56
- data/doc/release_notes/5.25.0.txt +0 -32
- data/doc/release_notes/5.26.0.txt +0 -35
- data/doc/release_notes/5.27.0.txt +0 -21
- data/doc/release_notes/5.28.0.txt +0 -16
- data/doc/release_notes/5.29.0.txt +0 -22
- data/doc/release_notes/5.3.0.txt +0 -121
- data/doc/release_notes/5.30.0.txt +0 -20
- data/doc/release_notes/5.31.0.txt +0 -148
- data/doc/release_notes/5.32.0.txt +0 -46
- data/doc/release_notes/5.33.0.txt +0 -24
- data/doc/release_notes/5.34.0.txt +0 -40
- data/doc/release_notes/5.35.0.txt +0 -56
- data/doc/release_notes/5.36.0.txt +0 -60
- data/doc/release_notes/5.37.0.txt +0 -30
- data/doc/release_notes/5.38.0.txt +0 -28
- data/doc/release_notes/5.39.0.txt +0 -19
- data/doc/release_notes/5.4.0.txt +0 -80
- data/doc/release_notes/5.40.0.txt +0 -40
- data/doc/release_notes/5.41.0.txt +0 -25
- data/doc/release_notes/5.42.0.txt +0 -136
- data/doc/release_notes/5.43.0.txt +0 -98
- data/doc/release_notes/5.44.0.txt +0 -32
- data/doc/release_notes/5.45.0.txt +0 -34
- data/doc/release_notes/5.46.0.txt +0 -87
- data/doc/release_notes/5.47.0.txt +0 -59
- data/doc/release_notes/5.48.0.txt +0 -14
- data/doc/release_notes/5.49.0.txt +0 -59
- data/doc/release_notes/5.5.0.txt +0 -61
- data/doc/release_notes/5.50.0.txt +0 -78
- data/doc/release_notes/5.51.0.txt +0 -47
- data/doc/release_notes/5.52.0.txt +0 -87
- data/doc/release_notes/5.53.0.txt +0 -23
- data/doc/release_notes/5.54.0.txt +0 -27
- data/doc/release_notes/5.55.0.txt +0 -21
- data/doc/release_notes/5.56.0.txt +0 -51
- data/doc/release_notes/5.57.0.txt +0 -23
- data/doc/release_notes/5.58.0.txt +0 -31
- data/doc/release_notes/5.59.0.txt +0 -73
- data/doc/release_notes/5.6.0.txt +0 -31
- data/doc/release_notes/5.60.0.txt +0 -22
- data/doc/release_notes/5.61.0.txt +0 -43
- data/doc/release_notes/5.62.0.txt +0 -132
- data/doc/release_notes/5.63.0.txt +0 -33
- data/doc/release_notes/5.64.0.txt +0 -50
- data/doc/release_notes/5.65.0.txt +0 -21
- data/doc/release_notes/5.66.0.txt +0 -24
- data/doc/release_notes/5.67.0.txt +0 -32
- data/doc/release_notes/5.68.0.txt +0 -61
- data/doc/release_notes/5.69.0.txt +0 -26
- data/doc/release_notes/5.7.0.txt +0 -108
- data/doc/release_notes/5.70.0.txt +0 -35
- data/doc/release_notes/5.71.0.txt +0 -21
- data/doc/release_notes/5.72.0.txt +0 -33
- data/doc/release_notes/5.73.0.txt +0 -66
- data/doc/release_notes/5.74.0.txt +0 -45
- data/doc/release_notes/5.75.0.txt +0 -35
- data/doc/release_notes/5.76.0.txt +0 -86
- data/doc/release_notes/5.77.0.txt +0 -63
- data/doc/release_notes/5.78.0.txt +0 -67
- data/doc/release_notes/5.79.0.txt +0 -28
- data/doc/release_notes/5.8.0.txt +0 -170
- data/doc/release_notes/5.80.0.txt +0 -40
- data/doc/release_notes/5.81.0.txt +0 -31
- data/doc/release_notes/5.82.0.txt +0 -61
- data/doc/release_notes/5.83.0.txt +0 -56
- data/doc/release_notes/5.9.0.txt +0 -99
- data/doc/schema_modification.rdoc +0 -679
- data/doc/security.rdoc +0 -443
- data/doc/sharding.rdoc +0 -286
- data/doc/sql.rdoc +0 -648
- data/doc/testing.rdoc +0 -204
- data/doc/thread_safety.rdoc +0 -15
- data/doc/transactions.rdoc +0 -250
- data/doc/validations.rdoc +0 -558
- data/doc/virtual_rows.rdoc +0 -265
@@ -1,33 +0,0 @@
|
|
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.
|
@@ -1,66 +0,0 @@
|
|
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.
|
@@ -1,45 +0,0 @@
|
|
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.
|
@@ -1,35 +0,0 @@
|
|
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).
|
@@ -1,86 +0,0 @@
|
|
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.
|
@@ -1,63 +0,0 @@
|
|
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.
|
@@ -1,67 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* SQLite 3.45+ jsonb functions are now supported in the sqlite_json_ops
|
4
|
-
extension. Similar to the postgres_json_ops extension, there are
|
5
|
-
now separate methods for dealing with json and jsonb types:
|
6
|
-
|
7
|
-
Sequel.sqlite_json_op(:column) # json
|
8
|
-
Sequel.sqlite_jsonb_op(:column) # jsonb
|
9
|
-
|
10
|
-
Some methods that use json_* functions for json ops use jsonb_*
|
11
|
-
functions for jsonb ops:
|
12
|
-
|
13
|
-
jb = Sequel.sqlite_jsonb_op(:column)
|
14
|
-
jb.extract('$.a') # jsonb_extract(column, '$.a')
|
15
|
-
jb.insert('$.a', 1) # jsonb_insert(column, '$.a', 1)
|
16
|
-
jb.set('$.a', 1) # jsonb_set(column, '$.a', 1)
|
17
|
-
jb.replace('$.a', 1) # jsonb_replace(column, '$.a', 1)
|
18
|
-
jb.remove('$.a') # jsonb_remove(column, '$.a')
|
19
|
-
jb.patch('{"a":2}') # jsonb_patch(column, '{"a":2}')
|
20
|
-
|
21
|
-
You can use the json and jsonb methods to convert jsonb to json
|
22
|
-
and json to jsonb, respectively.
|
23
|
-
|
24
|
-
jb.json # json(column)
|
25
|
-
|
26
|
-
Use of the json method on jsonb types is important, because if you
|
27
|
-
want to be able to deal with the values in Ruby, you must convert
|
28
|
-
the jsonb value to json in the database before the database returns
|
29
|
-
the value. Unlike PostgreSQL, SQLite will not convert the value
|
30
|
-
from jsonb to json on retrieval, and direct use of SQLite's jsonb
|
31
|
-
format is unsupported by SQLite as it is subject to change.
|
32
|
-
|
33
|
-
* Database#with_advisory_lock is now supported on PostgreSQL, MySQL,
|
34
|
-
and Microsoft SQL Server. This supports advisory (explicit)
|
35
|
-
locking, using the database-specific APIs. To work on all three
|
36
|
-
servers, lock ids should be integers in the signed 64-bit range.
|
37
|
-
|
38
|
-
DB.with_advisory_lock(1234) do
|
39
|
-
# do something
|
40
|
-
end
|
41
|
-
|
42
|
-
By default, an AdvisoryLockError is raised if the lock cannot be
|
43
|
-
immediately acquired. You can use the :wait option to wait until
|
44
|
-
the lock can be acquired, instead of raising.
|
45
|
-
|
46
|
-
DB.with_advisory_lock(1234, wait: true) do
|
47
|
-
# do something
|
48
|
-
end
|
49
|
-
|
50
|
-
* Migrator.run now supports a :use_advisory_lock option to use
|
51
|
-
advisory locks when running migrations, so that it does not
|
52
|
-
attempt to run the same migration more than once in the case
|
53
|
-
where multiple processes are running the migrator simultaneously.
|
54
|
-
It's probably best to avoid running the migrator in multiple
|
55
|
-
processes simultaneously instead of relying on this option.
|
56
|
-
|
57
|
-
= Other Improvements
|
58
|
-
|
59
|
-
* Database#values now supports chaining with compounds on
|
60
|
-
PostgreSQL.
|
61
|
-
|
62
|
-
DB.values([[1, 2]]).union(DB.values([[3, 4]]))
|
63
|
-
# SELECT * FROM (VALUES (1, 2) UNION (VALUES (3, 4))) AS t1
|
64
|
-
|
65
|
-
* The internal hash used to store transaction metadata now uses
|
66
|
-
compare_by_identity, which is faster and avoids potential
|
67
|
-
issues if a driver implements connection object equality.
|
@@ -1,28 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* Dataset#select_prepend has been added for prepending to the
|
4
|
-
currently selected columns:
|
5
|
-
|
6
|
-
DB[:table].select_prepend(:column)
|
7
|
-
# SELECT column, table.*
|
8
|
-
|
9
|
-
As not all databases support "SELECT column, *", select_prepend
|
10
|
-
qualifies wildcard selections to all tables referenced in the
|
11
|
-
query.
|
12
|
-
|
13
|
-
The only reason to use select_prepend is if you want the hashes
|
14
|
-
returned by Sequel to be in a specific order. Otherwise, it is
|
15
|
-
better to use select_append.
|
16
|
-
|
17
|
-
* On PostgreSQL, Sequel now supports an :unlogged_tables_default
|
18
|
-
Database option, which will default created tables to be UNLOGGED.
|
19
|
-
This can be useful to speedup testing in some cases, but it should
|
20
|
-
never be used in cases where data integrity is important.
|
21
|
-
|
22
|
-
= Other Improvements
|
23
|
-
|
24
|
-
* On PostgreSQL, Database#create_or_replace_view now supports the
|
25
|
-
:materialized option. This allows for dropping an existing
|
26
|
-
materialized view and creating a new one with the same name
|
27
|
-
(PostgreSQL does not have native support for replacing materialized
|
28
|
-
views).
|
data/doc/release_notes/5.8.0.txt
DELETED
@@ -1,170 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* A pg_auto_constraint_validations plugin has been added, which
|
4
|
-
automatically converts many constraint violations raised as
|
5
|
-
exceptions to ValidationFailed exceptions when saving a model
|
6
|
-
instance.
|
7
|
-
|
8
|
-
The following constraint violation types are recognized and
|
9
|
-
supported:
|
10
|
-
|
11
|
-
* NOT NULL
|
12
|
-
* CHECK
|
13
|
-
* UNIQUE (except expression/functional indexes)
|
14
|
-
* FOREIGN KEY (both referencing and referenced by)
|
15
|
-
|
16
|
-
In the cases where the plugin cannot determine an appropriate
|
17
|
-
validation failure for the constraint violation, it just
|
18
|
-
reraises the original exception.
|
19
|
-
|
20
|
-
This plugin is not intended as a replacement for other validations,
|
21
|
-
it is intended as a last resort. The purpose of validations is to
|
22
|
-
provide nice error messages for the user, and the error messages
|
23
|
-
generated by this plugin are fairly generic. The error messages can
|
24
|
-
be customized using the :messages plugin option, but there is only a
|
25
|
-
single message used per constraint type.
|
26
|
-
|
27
|
-
* Database#check_constraints has been added on PostgreSQL. This
|
28
|
-
returns metadata related to each check constraint on a table:
|
29
|
-
|
30
|
-
DB.create_table(:foo) do
|
31
|
-
Integer :i
|
32
|
-
Integer :j
|
33
|
-
constraint(:ic, Sequel[:i] > 2)
|
34
|
-
constraint(:jc, Sequel[:j] > 2)
|
35
|
-
constraint(:ijc, Sequel[:i] - Sequel[:j] > 2)
|
36
|
-
end
|
37
|
-
DB.check_constraints(:foo)
|
38
|
-
# => {
|
39
|
-
# :ic=>{:definition=>"CHECK ((i > 2))", :columns=>[:i]},
|
40
|
-
# :jc=>{:definition=>"CHECK ((j > 2))", :columns=>[:j]},
|
41
|
-
# :ijc=>{:definition=>"CHECK (((i - j) > 2))", :columns=>[:i, :j]}
|
42
|
-
# }
|
43
|
-
|
44
|
-
* Database#foreign_key_list now supports a :reverse option on
|
45
|
-
PostgreSQL, which returns foreign keys referencing the given table,
|
46
|
-
instead of of foreign keys in the given table referencing other
|
47
|
-
tables:
|
48
|
-
|
49
|
-
DB.create_table!(:a) do
|
50
|
-
primary_key :id
|
51
|
-
Integer :i
|
52
|
-
Integer :j
|
53
|
-
foreign_key :a_id, :a, :foreign_key_constraint_name=>:a_a
|
54
|
-
unique [:i, :j]
|
55
|
-
end
|
56
|
-
DB.create_table!(:b) do
|
57
|
-
foreign_key :a_id, :a, :foreign_key_constraint_name=>:a_a
|
58
|
-
Integer :c
|
59
|
-
Integer :d
|
60
|
-
foreign_key [:c, :d], :a, :key=>[:j, :i], :name=>:a_c_d
|
61
|
-
end
|
62
|
-
DB.foreign_key_list(:a, :reverse=>true)
|
63
|
-
# => [
|
64
|
-
# {:name=>:a_a, :columns=>[:a_id], :key=>[:id], :on_update=>:no_action,
|
65
|
-
# :on_delete=>:no_action, :deferrable=>false, :table=>:a, :schema=>:public},
|
66
|
-
# {:name=>:a_a, :columns=>[:a_id], :key=>[:id], :on_update=>:no_action,
|
67
|
-
# :on_delete=>:no_action, :deferrable=>false, :table=>:b, :schema=>:public},
|
68
|
-
# {:name=>:a_c_d, :columns=>[:c, :d], :key=>[:j, :i], :on_update=>:no_action,
|
69
|
-
# :on_delete=>:no_action, :deferrable=>false, :table=>:b, :schema=>:public}
|
70
|
-
# ]
|
71
|
-
|
72
|
-
* Dataset#nowait has been added, which will make the query fail
|
73
|
-
with a Sequel::DatabaseLockTimeout exception if it encounters
|
74
|
-
a locked row, overriding the default database behavior that
|
75
|
-
would wait until the lock was released. This method is supported
|
76
|
-
on PostgreSQL, Microsoft SQL Server, Oracle, and MySQL 8+.
|
77
|
-
|
78
|
-
* Database#indexes now supports an :include_partial option on
|
79
|
-
PostgreSQL, which will include partial indexes in the output (Sequel
|
80
|
-
by default excludes partial indexes).
|
81
|
-
|
82
|
-
* Common table expressions and window functions are now supported when
|
83
|
-
using MySQL 8+.
|
84
|
-
|
85
|
-
* Dataset#skip_locked is now supported on MySQL 8+.
|
86
|
-
|
87
|
-
* The connection_expiration extension now supports a
|
88
|
-
Database#connection_expiration_random_delay attribute, which is used
|
89
|
-
to randomize the expiration times, avoiding the thundering herd
|
90
|
-
problem.
|
91
|
-
|
92
|
-
* The pg_enum extension now supports a rename_enum method for renaming
|
93
|
-
existing enum types.
|
94
|
-
|
95
|
-
* Database#error_info on PostgreSQL now returns much more metadata
|
96
|
-
regarding the error.
|
97
|
-
|
98
|
-
= Other Improvements
|
99
|
-
|
100
|
-
* The dataset returned by the following dataset methods is cached,
|
101
|
-
which can improve performance significantly in certain cases:
|
102
|
-
|
103
|
-
* #distinct (without arguments or block)
|
104
|
-
* #from_self (without options)
|
105
|
-
* #lateral
|
106
|
-
* #qualify (without argument)
|
107
|
-
* #returning (without arguments)
|
108
|
-
* #select_all (without arguments)
|
109
|
-
|
110
|
-
* If the primary_key serial: true, type: :serial, or type: :bigserial
|
111
|
-
options are given on PostgreSQL 10.2+, use a serial primary key
|
112
|
-
instead of an identity primary key. This change was included in
|
113
|
-
Sequel 5.7.1.
|
114
|
-
|
115
|
-
* The :search_path Database option is now supported as a shard
|
116
|
-
option on PostgreSQL, so different shards can use different
|
117
|
-
search paths.
|
118
|
-
|
119
|
-
* The correct column order in Database#foreign_key_list on MySQL is
|
120
|
-
now forced, fixing issues on MySQL 8+.
|
121
|
-
|
122
|
-
* When using case sensitive regexp matches on MySQL 8+, Sequel now
|
123
|
-
uses the REGEXP_LIKE function instead of the REGEXP BINARY
|
124
|
-
operator, to work around what appears to be a bug in MySQL 8+
|
125
|
-
related to the change in MySQL's regexp engine.
|
126
|
-
|
127
|
-
* On MySQL 5.7+, the :extended option to Dataset#explain is now
|
128
|
-
ignored, since the :extended option's behavior in previous
|
129
|
-
MySQL versions is now the default behavior.
|
130
|
-
|
131
|
-
* The MySQL HY000 generic SQL state error code is now ignored
|
132
|
-
in the mysql2 adapter, so it falls back to using the more
|
133
|
-
accurate backup error mapping in that case.
|
134
|
-
|
135
|
-
* The pg_enum extension's schema modification methods now work
|
136
|
-
correctly if the Database instance is frozen.
|
137
|
-
|
138
|
-
* The tactical_eager_loading plugin now respects the :allow_eager
|
139
|
-
association option, and will not attempt to eagerly load
|
140
|
-
associations when :allow_eager is false.
|
141
|
-
|
142
|
-
* Using multiple add_constraint calls and a set_column_null call in
|
143
|
-
the same alter_table block on SQLite now works correctly. Note
|
144
|
-
that if you are planning on ever modifying existing tables beyond
|
145
|
-
adding columns, you should probably choose a database that natively
|
146
|
-
supports such modification (SQLite does not).
|
147
|
-
|
148
|
-
* Hashes returned by Database#foreign_key_list on PostgreSQL now
|
149
|
-
include a :schema entry, unless the support has been enabled
|
150
|
-
to make the :table entry be a qualified identifier.
|
151
|
-
|
152
|
-
* Dataset#support_cte?(:insert) no longer returns true on
|
153
|
-
SQLAnywhere. SQLAnywhere only supports common table
|
154
|
-
expressions for INSERT ... SELECT, not for all INSERT
|
155
|
-
statements. INSERT ... WITH ... SELECT is already
|
156
|
-
supported in Sequel using:
|
157
|
-
|
158
|
-
DB[:t1].insert(DB[:t2].with(DB[:t3]))
|
159
|
-
|
160
|
-
* Model#_valid? is no longer made a public method in the
|
161
|
-
error_splitter plugin.
|
162
|
-
|
163
|
-
= Backwards Compatibility
|
164
|
-
|
165
|
-
* Calling the filter method on a proxy object returned by the
|
166
|
-
association_proxies plugin now warns on ruby <2.6. This is
|
167
|
-
because starting in ruby 2.6, the behavior will change and the
|
168
|
-
method will be called on the array of associated objects
|
169
|
-
instead of on the dataset, as Enumerable#filter is being added
|
170
|
-
in ruby 2.6.
|
@@ -1,40 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* A provenance dataset extension has been added. This extension makes
|
4
|
-
SQL queries include a comment describing how the dataset was built.
|
5
|
-
This can make debugging complex cases significantly easier. Here's
|
6
|
-
a simple example:
|
7
|
-
|
8
|
-
DB.extension :provenance
|
9
|
-
|
10
|
-
DB[:table].
|
11
|
-
select(:a).
|
12
|
-
where{b > 10}.
|
13
|
-
order(:c).
|
14
|
-
limit(10)
|
15
|
-
# SQL:
|
16
|
-
# SELECT a FROM table WHERE (b > 10) ORDER BY c LIMIT 10 --
|
17
|
-
# -- Dataset Provenance
|
18
|
-
# -- Keys:[:from] Source:(eval at bin/sequel:257):2:in `<main>'
|
19
|
-
# -- Keys:[:select] Source:(eval at bin/sequel:257):3:in `<main>'
|
20
|
-
# -- Keys:[:where] Source:(eval at bin/sequel:257):4:in `<main>'
|
21
|
-
# -- Keys:[:order] Source:(eval at bin/sequel:257):5:in `<main>'
|
22
|
-
# -- Keys:[:limit] Source:(eval at bin/sequel:257):6:in `<main>'
|
23
|
-
|
24
|
-
With the above example, it's obvious how the dataset is created, but
|
25
|
-
but in real applications, where datasets can be built from multiple
|
26
|
-
files, seeing where each dataset clone was made can be helpful.
|
27
|
-
|
28
|
-
The source listed will skip locations in the Ruby standard library
|
29
|
-
as well as Sequel itself. Other locations can be skipped by
|
30
|
-
providing a Database :provenance_caller_ignore Regexp option:
|
31
|
-
|
32
|
-
DB.opts[:provenance_caller_ignore] = /\/gems\/library_name-/
|
33
|
-
|
34
|
-
= Other Improvements
|
35
|
-
|
36
|
-
* For dataset methods where Sequel can determine that the return
|
37
|
-
value would be equivalent to the receiver, Sequel now returns the
|
38
|
-
receiver. This reduces the number of dataset allocations.
|
39
|
-
|
40
|
-
* Sequel now supports Dataset#skip_locked on MariaDB 10.6+.
|
@@ -1,31 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* A temporarily_release_connection Database extension has been added,
|
4
|
-
designed for multithreaded transactional testing.
|
5
|
-
|
6
|
-
This allows one thread to start a transaction, and then release
|
7
|
-
the connection back for usage by the connection pool, so that
|
8
|
-
other threads can operate on the connection object safely inside
|
9
|
-
the transaction. This requires the connection pool be limited
|
10
|
-
to a single connection, to ensure that the released connection
|
11
|
-
can be reacquired. It's not perfect, because if the connection
|
12
|
-
is disconnected and removed from the pool while temporarily
|
13
|
-
released, there is no way to handle that situation correctly.
|
14
|
-
Example:
|
15
|
-
|
16
|
-
DB.transaction(rollback: :always, auto_savepoint: true) do |conn|
|
17
|
-
DB.temporarily_release_connection(conn) do
|
18
|
-
# Other threads can operate on connection safely inside
|
19
|
-
# the transaction
|
20
|
-
yield
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
= Other Improvements
|
25
|
-
|
26
|
-
* In the caller_logging and provenance extensions, Ruby internal
|
27
|
-
caller locations are skipped when trying to locate the appropriate
|
28
|
-
caller line to include.
|
29
|
-
|
30
|
-
* A couple ignored block warnings in plugin apply methods have been
|
31
|
-
fixed on Ruby 3.4.
|