sequel 5.82.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/bin/sequel +9 -17
- data/lib/sequel/adapters/jdbc/derby.rb +1 -1
- data/lib/sequel/adapters/shared/db2.rb +1 -1
- data/lib/sequel/adapters/shared/mssql.rb +14 -2
- data/lib/sequel/adapters/shared/postgres.rb +42 -4
- data/lib/sequel/adapters/shared/sqlite.rb +3 -1
- data/lib/sequel/database/connecting.rb +1 -4
- data/lib/sequel/database/misc.rb +27 -7
- data/lib/sequel/database/schema_methods.rb +17 -1
- data/lib/sequel/dataset/sql.rb +13 -0
- data/lib/sequel/extensions/pg_json_ops.rb +328 -1
- data/lib/sequel/extensions/stdio_logger.rb +48 -0
- data/lib/sequel/extensions/string_agg.rb +15 -2
- data/lib/sequel/plugins/defaults_setter.rb +16 -4
- data/lib/sequel/plugins/optimistic_locking.rb +2 -0
- data/lib/sequel/sql.rb +8 -5
- data/lib/sequel/version.rb +1 -1
- metadata +4 -235
- data/CHANGELOG +0 -1377
- 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.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,56 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* A :cache_file plugin option has been added to the
|
4
|
-
pg_auto_constraint_validations plugin. This option specifies
|
5
|
-
a file to use to cache the metadata the plugin uses, so the
|
6
|
-
plugin does not need to run 5 queries per model at startup to
|
7
|
-
load the metadata. This can dramatically improve startup time
|
8
|
-
when using the plugin with a large number of models.
|
9
|
-
|
10
|
-
To create the metadata file, load the plugin into Sequel::Model
|
11
|
-
(or whatever class you are using as the base class for your
|
12
|
-
model classes) with the :cache_file option, and after loading
|
13
|
-
all of the subclasses of that class, run:
|
14
|
-
|
15
|
-
Sequel::Model.dump_pg_auto_constraint_validations_cache
|
16
|
-
|
17
|
-
As when using the schema_caching and index_caching extensions,
|
18
|
-
it is up to the user to ensure that the cached metadata matches
|
19
|
-
the current database schema. Sequel does no checking of this,
|
20
|
-
as checking would take more time, and the point of this plugin
|
21
|
-
is to improve startup performance.
|
22
|
-
|
23
|
-
* A static_cache_cache plugin has been added. This plugin allows
|
24
|
-
for caching rows for models using the static_cache plugin. This
|
25
|
-
prevents the need to issue a query at model creation time to
|
26
|
-
get the rows. This plugin should be loaded into Sequel::Model
|
27
|
-
(or whatever class you are using as the base class for your
|
28
|
-
model classes) before loading the models using the static_cache
|
29
|
-
plugin. To create the metadata file, after all subclasses of
|
30
|
-
that class have been loaded, run:
|
31
|
-
|
32
|
-
Sequel::Model.dump_static_cache_cache
|
33
|
-
|
34
|
-
* :unique_deferrable and :primary_key_deferrable column
|
35
|
-
options are now supported on PostgreSQL 9+ and Oracle. This
|
36
|
-
allows you to created deferrable unique and primary key
|
37
|
-
column constraints. You could already create deferrable
|
38
|
-
table constraints using the :deferrable option to the primary_key
|
39
|
-
and unique methods.
|
40
|
-
|
41
|
-
* A :generated_always_as column option is now supported on
|
42
|
-
PostgreSQL 12+, for creating generated columns.
|
43
|
-
|
44
|
-
* A Database#skip_logging? private method has been added. This
|
45
|
-
is designed for use in extensions, to force log timing even
|
46
|
-
when no loggers are configured.
|
47
|
-
|
48
|
-
= Other Improvements
|
49
|
-
|
50
|
-
* Sequel no longer sets the :host option to localhost by default
|
51
|
-
in the mysql2 adapter. This prevents Sequel from overriding
|
52
|
-
a host specified in the defaults_file.
|
53
|
-
|
54
|
-
* All database array types are converted to Ruby arrays in the
|
55
|
-
jdbc adapter. Previously, this was only done in the
|
56
|
-
jdbc/postgresql subadapter.
|
@@ -1,32 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* An association_multi_add_remove plugin has been added. This plugin
|
4
|
-
adds a shortcut for adding or removing multiple associated objects
|
5
|
-
in a single method call:
|
6
|
-
|
7
|
-
Artist.plugin :association_multi_add_remove
|
8
|
-
Artist.many_to_one :albums
|
9
|
-
Artist[1].add_albums([Album[2], Album[3]])
|
10
|
-
Artist[1].remove_albums([Album[4], Album[5]])
|
11
|
-
|
12
|
-
It also offers a setter method, which will add and remove associated
|
13
|
-
objects as necessary:
|
14
|
-
|
15
|
-
Artist[1].albums = [Album[3], Album[4]]
|
16
|
-
|
17
|
-
= Other Improvements
|
18
|
-
|
19
|
-
* The sharding plugin now integrates with the server_block extension.
|
20
|
-
This makes it so if you retrieve a model instance inside a
|
21
|
-
with_server block, saving the model instance will save it back to
|
22
|
-
the shard from which it was retrieved.
|
23
|
-
|
24
|
-
* Setting a default for a column on Microsoft SQL Server now works
|
25
|
-
correctly if the column already has a default.
|
26
|
-
|
27
|
-
* Sequel::SQL::NumericMethods#coerce no longer raises NoMethodError
|
28
|
-
if the super method is not defined. This fixes some cases when
|
29
|
-
comparing Date/DateTime instances to Sequel objects.
|
30
|
-
|
31
|
-
* The csv_serializer plugin now avoids keyword argument separation
|
32
|
-
issues on Ruby 2.7+.
|
@@ -1,35 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* Support for SQL/JSON path expressions has been added to the
|
4
|
-
pg_json_ops extension. These are supported in PostgreSQL 12+.
|
5
|
-
Examples:
|
6
|
-
|
7
|
-
j = Sequel.pg_json_op(:json_column)
|
8
|
-
j.path_exists('$.foo') # (jsonb_column @? '$.foo')
|
9
|
-
j.path_match('$.foo') # (jsonb_column @@ '$.foo')
|
10
|
-
j.path_exists!('$.foo') # jsonb_path_exists(jsonb_column, '$.foo')
|
11
|
-
j.path_match!('$.foo') # jsonb_path_match(jsonb_column, '$.foo')
|
12
|
-
j.path_query('$.foo') # jsonb_path_query(jsonb_column, '$.foo')
|
13
|
-
j.path_query_array('$.foo') # jsonb_path_query_array(jsonb_column, '$.foo')
|
14
|
-
j.path_query_first('$.foo') # jsonb_path_query_first(jsonb_column, '$.foo')
|
15
|
-
|
16
|
-
* The nested_attributes method in the nested_attributes plugin now
|
17
|
-
supports a :require_modification option, which can override the
|
18
|
-
default require_modification setting for the nested objects. This
|
19
|
-
can be useful to avoid errors if multiple requests are submitted
|
20
|
-
simultaneously to delete the same nested row.
|
21
|
-
|
22
|
-
= Other Improvements
|
23
|
-
|
24
|
-
* The dirty plugin now works correctly with the typecast_on_load
|
25
|
-
plugin.
|
26
|
-
|
27
|
-
* Sequel::Postgres::PGRange#hash has been added to the pg_range
|
28
|
-
extension, allowing PGRange instances to be usable as hash keys.
|
29
|
-
|
30
|
-
* Table aliases are now supported for single table INSERT
|
31
|
-
statements on PostgreSQL 9.5+, which can make some insert_conflict
|
32
|
-
usage easier.
|
33
|
-
|
34
|
-
* Two more foreign key constraint violation types are now recognized
|
35
|
-
on MySQL 8.0.13+.
|
@@ -1,21 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* Sequel::DEFAULT has been added a constant for the DEFAULT expression,
|
4
|
-
useful in inserts and especially updates:
|
5
|
-
|
6
|
-
DB[:a].where(:id=>1).update(:b=>Sequel::DEFAULT)
|
7
|
-
# UPDATE "a" SET "b" = DEFAULT WHERE "id" = 1
|
8
|
-
|
9
|
-
* SQL::Function#filter for filtered aggregate functions is now
|
10
|
-
supported on all databases. On databases not supporting it natively
|
11
|
-
(all except PostgreSQL 9.4+ and SQLite 3.30+), a CASE statement is
|
12
|
-
used to emulate the support.
|
13
|
-
|
14
|
-
= Other Improvements
|
15
|
-
|
16
|
-
* NULLS FIRST/LAST is now used without emulation on SQLite 3.30+.
|
17
|
-
|
18
|
-
* The pg_enum extension now works correctly on PostgreSQL 8.3-9.0.
|
19
|
-
|
20
|
-
* Postgres::ArrayOp#join in the pg_array_ops extension now works
|
21
|
-
correctly on PostgreSQL <9.1.
|
@@ -1,16 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* An any_not_empty extension has been added, for making Dataset#any?
|
4
|
-
without a block be the same as !empty?. This can result in a
|
5
|
-
much faster database query.
|
6
|
-
|
7
|
-
* An exclude_or_null extension has been added, adding a
|
8
|
-
Dataset#exclude_or_null method that returns rows where the given
|
9
|
-
expression is false or NULL. This extension is supported on
|
10
|
-
PostgreSQL, SQLite, MySQL, H2, and HSQLDB.
|
11
|
-
|
12
|
-
= Other Improvements
|
13
|
-
|
14
|
-
* When using the jdbc/postgresql adapter, calling with_fetch_size
|
15
|
-
on a dataset will emit a warning. This is because the driver
|
16
|
-
will ignore the setting.
|
@@ -1,22 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* An empty_failure_backtraces plugin has been added for using empty
|
4
|
-
backtraces for ValidationFailed and HookFailed exceptions. In many
|
5
|
-
cases, these exceptions are automatically handled (e.g. web form
|
6
|
-
submission handling to display appropriate error pages), and using
|
7
|
-
empty backtraces is 10-15x faster on JRuby 9.2.7.0+.
|
8
|
-
|
9
|
-
* Dataset#json_serializer_opts has been added to the json_serializer
|
10
|
-
plugin. This allows setting default options on a per-Dataset basis
|
11
|
-
for all Dataset#to_json calls.
|
12
|
-
|
13
|
-
= Other Improvements
|
14
|
-
|
15
|
-
* Another disconnect error is now recognized in the tinytds adapter.
|
16
|
-
|
17
|
-
* Using Sequel with the the CRuby master branch (what will be Ruby 3)
|
18
|
-
now works by supporting a second argument for
|
19
|
-
Dataset#initialize_clone.
|
20
|
-
|
21
|
-
* Sequel now avoids a warning in verbose mode when using the postgres
|
22
|
-
adapter, a recent version of ruby-pg, and bound variables.
|
data/doc/release_notes/5.3.0.txt
DELETED
@@ -1,121 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* An :extensions Database option is now supported, which will load the
|
4
|
-
named extensions into the Database before any connections are
|
5
|
-
initiated:
|
6
|
-
|
7
|
-
DB = Sequel.connect('mock:///', :extensions=>[:error_sql, :synchronize_sql])
|
8
|
-
DB = Sequel.connect('mock:///?extensions=error_sql,synchronize_sql')
|
9
|
-
|
10
|
-
* A :connect_sqls Database option is now supported, which will issue
|
11
|
-
the given queries on all new connections:
|
12
|
-
|
13
|
-
DB = Sequel.connect('postgres:///', :connect_sqls=>[
|
14
|
-
'SET random_page_cost = 1.0',
|
15
|
-
"SET default_tablespace = 'foo'"
|
16
|
-
])
|
17
|
-
|
18
|
-
* DatasetModule#reverse has been added for simpler use of descending
|
19
|
-
orders:
|
20
|
-
|
21
|
-
class Foo < Sequel::Model
|
22
|
-
dataset_module do
|
23
|
-
reverse :newest_first, :created_at
|
24
|
-
end
|
25
|
-
end
|
26
|
-
Foo.newest_first.first(10)
|
27
|
-
|
28
|
-
* A synchronize_sql extension has been added. This extension checks
|
29
|
-
out a connection around SQL string creation, and is useful in the
|
30
|
-
cases where escaping values in the query requires a connection and
|
31
|
-
a large number of values need to be escaped.
|
32
|
-
|
33
|
-
* The following features are now supported on MariaDB 10.2+:
|
34
|
-
|
35
|
-
* Common table expressions.
|
36
|
-
|
37
|
-
* Window functions.
|
38
|
-
|
39
|
-
* Dropping CHECK constraints. Older versions of MariaDB/MySQL
|
40
|
-
ignored CHECK constraints that were added, and Sequel did not
|
41
|
-
attempt to filter them out, so Sequel did not require changes to
|
42
|
-
add CHECK constraints. MariaDB 10.2 CHECK constraints work
|
43
|
-
correctly with Sequel's constraint_validations extension/plugin.
|
44
|
-
|
45
|
-
* Raising CHECK constraint violations as
|
46
|
-
Sequel::CheckConstraintViolation instances.
|
47
|
-
|
48
|
-
* Recognizing curdate() as Sequel::CURRENT_DATE when used as the
|
49
|
-
default value for a date column.
|
50
|
-
|
51
|
-
* Date::Infinity values are now supported in the
|
52
|
-
pg_extended_date_support extension:
|
53
|
-
|
54
|
-
DB.convert_infinite_timestamps = :date
|
55
|
-
|
56
|
-
This returns infinite dates/timestamps as Date::Infinity instances,
|
57
|
-
and literalizes Date::Infinity instances correctly.
|
58
|
-
|
59
|
-
= Improvements
|
60
|
-
|
61
|
-
* Database#reset_primary_key_sequence now works correctly on
|
62
|
-
PostgreSQL 10.
|
63
|
-
|
64
|
-
* If a commit or rollback raises an exception when using the postgres
|
65
|
-
adapter, Sequel will check the connection's current transaction
|
66
|
-
status and only send another rollback if the connection is currently
|
67
|
-
inside a transaction. This fixes a warning that is issued in most
|
68
|
-
cases if a commit or rollback fails.
|
69
|
-
|
70
|
-
* The jdbc/postgresql adapter now forces JDBC PreparedStatement
|
71
|
-
instances created by Dataset#call to never be prepared server side,
|
72
|
-
working around an caching issue in the jdbc-postgres drier in
|
73
|
-
versions greater than 9.4.1200.
|
74
|
-
|
75
|
-
* Database#indexes will no longer return indexes which are in the
|
76
|
-
process of being dropped on PostgreSQL 9.3+. Additionally,
|
77
|
-
Database#indexes will now return indexes that have indcheckxmin
|
78
|
-
set. The previous removal of indexes with indcheckxmin set is
|
79
|
-
more likely to cause false negatives than correctly remove
|
80
|
-
indexes not yet valid.
|
81
|
-
|
82
|
-
* Common table expressions are no longer hoisted from subqueries on
|
83
|
-
SQLite. They are still hoisted from queries used in
|
84
|
-
UNION/INSERT/EXCEPT, since SQLite does not support common table
|
85
|
-
expressions at that level.
|
86
|
-
|
87
|
-
* On Microsoft SQL Server, using an INSERT query with a subquery that
|
88
|
-
uses a common table expression now hoists the common table
|
89
|
-
expression from subquery level to main query level, allowing such
|
90
|
-
queries to work.
|
91
|
-
|
92
|
-
* An additional disconnect error is now recognized in the oracle
|
93
|
-
adapter.
|
94
|
-
|
95
|
-
* bin/sequel now adds a Database logger before the initial
|
96
|
-
connection is made, allowing you to see any connection setup
|
97
|
-
statements issued to the database.
|
98
|
-
|
99
|
-
= Backwards Compatibility
|
100
|
-
|
101
|
-
* Calling a filtering method with no argument and a virtual row
|
102
|
-
block that returns nil on a dataset with no existing filter is
|
103
|
-
deprecated in this version and will emit a warning. The behavior
|
104
|
-
in this version remains the same, where the dataset is not
|
105
|
-
modified. The behavior will change in Sequel 5.4.0 so that a
|
106
|
-
WHERE NULL filter will be added in that case, instead of the
|
107
|
-
filter being ignored, so that the behavior is similar to calling
|
108
|
-
the filtering method with a nil argument.
|
109
|
-
|
110
|
-
# Sequel 5.3.0
|
111
|
-
DB[:a].where{nil}
|
112
|
-
# SELECT * FROM a
|
113
|
-
|
114
|
-
# Sequel 5.4.0
|
115
|
-
DB[:a].where{nil}
|
116
|
-
# SELECT * FROM a WHERE NULL
|
117
|
-
|
118
|
-
* Support for PostgreSQL <8.1 has been dropped from Database#indexes.
|
119
|
-
Sequel's PostgreSQL support requires >=8.2 for Dataset#insert to
|
120
|
-
work, so it doesn't make sense to support earlier versions in other
|
121
|
-
cases.
|
@@ -1,20 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* Sequel now supports generated columns on SQLite 3.31+ using the
|
4
|
-
:generated_always_as and :generated_type options. Example:
|
5
|
-
|
6
|
-
DB.create_table(:table) do
|
7
|
-
primary_key :id
|
8
|
-
Numeric :amount, null: false
|
9
|
-
Numeric :tax, null: false
|
10
|
-
Numeric :total, generated_always_as: (Sequel[:amount] + :tax)
|
11
|
-
end
|
12
|
-
|
13
|
-
= Other Improvements
|
14
|
-
|
15
|
-
* The Database#transaction :before_retry option is now called before
|
16
|
-
retrying the transaction even when the :num_retries option is set
|
17
|
-
to nil.
|
18
|
-
|
19
|
-
* The gem no longer ships with specs and older release notes, reducing
|
20
|
-
the gem size by over 40%.
|
@@ -1,148 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* A forbid_lazy_load plugin has been added to forbid the lazy loading
|
4
|
-
of model associations if the current object was retreived with other
|
5
|
-
objects. This plugin helps detect N+1 query issues. This plugin
|
6
|
-
will raise an error if a lazy load is detected in such cases:
|
7
|
-
|
8
|
-
Album.plugin :forbid_lazy_load
|
9
|
-
Album.one_to_many :tracks
|
10
|
-
|
11
|
-
Album.each do |album|
|
12
|
-
album.tracks
|
13
|
-
# Could be N+1, raises Sequel::Plugins::ForbidLazyLoad::Error
|
14
|
-
end
|
15
|
-
|
16
|
-
Album.first.tracks
|
17
|
-
# Could not be N+1, no error raised
|
18
|
-
|
19
|
-
The forbid_lazy_load plugin is designed to be loaded into the base
|
20
|
-
model class (generally Sequel::Model), and can be loaded only in
|
21
|
-
test mode, or only in certain test mode configurations, so that it
|
22
|
-
does not have any production performance impact.
|
23
|
-
|
24
|
-
Note that an alternative approach that Sequel has supported for many
|
25
|
-
years is the tactical_eager_loading plugin, which automatically
|
26
|
-
eager loads when an N+1 query issue is detected.
|
27
|
-
|
28
|
-
* An association_lazy_eager_option plugin has been added which supports
|
29
|
-
the :eager option for the association method. If the association has
|
30
|
-
not been loaded, this eagerly loads the associations specified by the
|
31
|
-
:eager option when loading the association. If the association has
|
32
|
-
already been loaded, this option is ignored, with the assumption that
|
33
|
-
whatever loaded the association already used the correct eager
|
34
|
-
loading. Example:
|
35
|
-
|
36
|
-
Album.plugin :association_lazy_eager_option
|
37
|
-
Album.one_to_many :tracks
|
38
|
-
Track.many_to_one :artist
|
39
|
-
|
40
|
-
album = Album.first
|
41
|
-
album.tracks(:eager=>:artist)
|
42
|
-
# Loads tracks for album, then artist for each track (2 queries)
|
43
|
-
|
44
|
-
album.tracks(:eager=>:artist)
|
45
|
-
# No query issued as association is cached
|
46
|
-
|
47
|
-
You could previously have similar behavior for uncached associations
|
48
|
-
by passing a block to the association method and calling eager on
|
49
|
-
the yielded dataset. However, that would ignore any cached
|
50
|
-
association, causing redundant loading of the association in such
|
51
|
-
cases.
|
52
|
-
|
53
|
-
* On PostgreSQL 10+, creating partitioned tables and partitions of
|
54
|
-
other tables is now supported.
|
55
|
-
|
56
|
-
To create a partitioned table, use the :partition_by option:
|
57
|
-
|
58
|
-
DB.create_table(:table1, partition_by: :date_column,
|
59
|
-
partition_type: :range) do
|
60
|
-
Integer :id
|
61
|
-
Date :date_column
|
62
|
-
end
|
63
|
-
|
64
|
-
DB.create_table(:table2, partition_by: :string_column,
|
65
|
-
partition_type: :list) do
|
66
|
-
Integer :id
|
67
|
-
String :string_column
|
68
|
-
end
|
69
|
-
|
70
|
-
DB.create_table(:table3, partition_by: :int_column,
|
71
|
-
partition_type: :hash) do
|
72
|
-
Integer :id
|
73
|
-
Integer :int_column
|
74
|
-
end
|
75
|
-
|
76
|
-
To add partitions of other tables, use the :partition_of option.
|
77
|
-
This option will use a custom DSL specific to partitions of other
|
78
|
-
tables.
|
79
|
-
|
80
|
-
For range partitioning, you can use the from and to methods to
|
81
|
-
specify the inclusive beginning and exclusive ending of the range
|
82
|
-
of the partition. You can call the minvalue and maxvalue methods
|
83
|
-
to get the minimum and maximum values for the column(s) in the
|
84
|
-
range, useful as arguments to from and to:
|
85
|
-
|
86
|
-
DB.create_table(:table1a, partition_of: :table1) do
|
87
|
-
from minvalue
|
88
|
-
to 0
|
89
|
-
end
|
90
|
-
DB.create_table(:table1b, partition_of: :table1) do
|
91
|
-
from 0
|
92
|
-
to 100
|
93
|
-
end
|
94
|
-
DB.create_table(:table1c, partition_of: :table1) do
|
95
|
-
from 100
|
96
|
-
to maxvalue
|
97
|
-
end
|
98
|
-
|
99
|
-
For list partitioning, you use the values_in method. You can also
|
100
|
-
use the default method to mark a partition as the default partition:
|
101
|
-
|
102
|
-
DB.create_table(:table2a, partition_of: :table2) do
|
103
|
-
values_in 1, 2, 3
|
104
|
-
end
|
105
|
-
DB.create_table(:table2b, partition_of: :table2) do
|
106
|
-
values_in 4, 5, 6
|
107
|
-
end
|
108
|
-
DB.create_table(:table2c, partition_of: :table2) do
|
109
|
-
default
|
110
|
-
end
|
111
|
-
|
112
|
-
For hash partitioning, you use the modulus and remainder methods:
|
113
|
-
|
114
|
-
DB.create_table(:table3a, partition_of: :table3) do
|
115
|
-
modulus 3
|
116
|
-
remainder 0
|
117
|
-
end
|
118
|
-
DB.create_table(:table3b, partition_of: :table3) do
|
119
|
-
modulus 3
|
120
|
-
remainder 1
|
121
|
-
end
|
122
|
-
DB.create_table(:table3c, partition_of: :table3) do
|
123
|
-
modulus 3
|
124
|
-
remainder 2
|
125
|
-
end
|
126
|
-
|
127
|
-
* On PostgreSQL 12+ and SQLite 3.31+, column schema hashes now have
|
128
|
-
a :generated entry for whether the column is a generated column.
|
129
|
-
|
130
|
-
* The schema_dumper extension now dumps generated columns correctly
|
131
|
-
when using the :same_db option on PostgreSQL 12+.
|
132
|
-
|
133
|
-
* A skip_saving_columns plugin has been added. This allows skipping
|
134
|
-
saving of specific columns for the model. By default, it skips
|
135
|
-
saving of generated columns, but you can customize the columns
|
136
|
-
that it skips:
|
137
|
-
|
138
|
-
Album.plugin :skip_saving_columns
|
139
|
-
Album.skip_saving_columns = [:some_column]
|
140
|
-
|
141
|
-
= Other Improvements
|
142
|
-
|
143
|
-
* The alter_table drop_constraint :primary_key option on SQLite now
|
144
|
-
works correctly for non-integer primary keys.
|
145
|
-
|
146
|
-
* When an error is raised due to an irreversible migration, the error
|
147
|
-
message now includes the file containing the migration for easier
|
148
|
-
debugging.
|
@@ -1,46 +0,0 @@
|
|
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.
|
@@ -1,24 +0,0 @@
|
|
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.
|
@@ -1,40 +0,0 @@
|
|
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.
|
@@ -1,56 +0,0 @@
|
|
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.
|