sequel 5.19.0 → 5.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +102 -0
- data/doc/dataset_filtering.rdoc +15 -0
- data/doc/opening_databases.rdoc +5 -1
- data/doc/release_notes/5.20.0.txt +89 -0
- data/doc/release_notes/5.21.0.txt +87 -0
- data/doc/release_notes/5.22.0.txt +48 -0
- data/doc/release_notes/5.23.0.txt +56 -0
- data/doc/release_notes/5.24.0.txt +56 -0
- data/doc/sharding.rdoc +2 -0
- data/doc/testing.rdoc +1 -0
- data/doc/transactions.rdoc +38 -0
- data/lib/sequel/adapters/ado.rb +27 -19
- data/lib/sequel/adapters/jdbc.rb +7 -1
- data/lib/sequel/adapters/jdbc/mysql.rb +2 -2
- data/lib/sequel/adapters/jdbc/postgresql.rb +1 -13
- data/lib/sequel/adapters/jdbc/sqlite.rb +29 -0
- data/lib/sequel/adapters/mysql2.rb +2 -3
- data/lib/sequel/adapters/shared/mssql.rb +7 -7
- data/lib/sequel/adapters/shared/postgres.rb +37 -19
- data/lib/sequel/adapters/shared/sqlite.rb +27 -3
- data/lib/sequel/adapters/sqlite.rb +1 -1
- data/lib/sequel/adapters/tinytds.rb +12 -0
- data/lib/sequel/adapters/utils/mysql_mysql2.rb +2 -0
- data/lib/sequel/database/logging.rb +7 -1
- data/lib/sequel/database/query.rb +1 -1
- data/lib/sequel/database/schema_generator.rb +12 -3
- data/lib/sequel/database/schema_methods.rb +2 -0
- data/lib/sequel/database/transactions.rb +57 -5
- data/lib/sequel/dataset.rb +4 -2
- data/lib/sequel/dataset/actions.rb +3 -2
- data/lib/sequel/dataset/placeholder_literalizer.rb +4 -1
- data/lib/sequel/dataset/query.rb +5 -1
- data/lib/sequel/dataset/sql.rb +11 -7
- data/lib/sequel/extensions/named_timezones.rb +52 -8
- data/lib/sequel/extensions/pg_array.rb +4 -0
- data/lib/sequel/extensions/pg_json.rb +387 -123
- data/lib/sequel/extensions/pg_range.rb +3 -2
- data/lib/sequel/extensions/pg_row.rb +3 -1
- data/lib/sequel/extensions/schema_dumper.rb +1 -1
- data/lib/sequel/extensions/server_block.rb +15 -4
- data/lib/sequel/model/associations.rb +35 -9
- data/lib/sequel/model/plugins.rb +104 -0
- data/lib/sequel/plugins/association_dependencies.rb +3 -3
- data/lib/sequel/plugins/association_pks.rb +14 -4
- data/lib/sequel/plugins/association_proxies.rb +3 -2
- data/lib/sequel/plugins/class_table_inheritance.rb +11 -0
- data/lib/sequel/plugins/composition.rb +13 -9
- data/lib/sequel/plugins/finder.rb +2 -2
- data/lib/sequel/plugins/hook_class_methods.rb +17 -5
- data/lib/sequel/plugins/insert_conflict.rb +72 -0
- data/lib/sequel/plugins/inverted_subsets.rb +2 -2
- data/lib/sequel/plugins/pg_auto_constraint_validations.rb +147 -59
- data/lib/sequel/plugins/rcte_tree.rb +6 -0
- data/lib/sequel/plugins/static_cache.rb +8 -3
- data/lib/sequel/plugins/static_cache_cache.rb +53 -0
- data/lib/sequel/plugins/subset_conditions.rb +2 -2
- data/lib/sequel/plugins/validation_class_methods.rb +5 -3
- data/lib/sequel/sql.rb +15 -3
- data/lib/sequel/timezones.rb +50 -11
- data/lib/sequel/version.rb +1 -1
- data/spec/adapters/mssql_spec.rb +24 -0
- data/spec/adapters/mysql_spec.rb +0 -5
- data/spec/adapters/postgres_spec.rb +319 -1
- data/spec/bin_spec.rb +1 -1
- data/spec/core/database_spec.rb +123 -2
- data/spec/core/dataset_spec.rb +33 -1
- data/spec/core/expression_filters_spec.rb +25 -1
- data/spec/core/schema_spec.rb +24 -0
- data/spec/extensions/class_table_inheritance_spec.rb +30 -8
- data/spec/extensions/core_refinements_spec.rb +1 -1
- data/spec/extensions/hook_class_methods_spec.rb +22 -0
- data/spec/extensions/insert_conflict_spec.rb +103 -0
- data/spec/extensions/migration_spec.rb +13 -0
- data/spec/extensions/named_timezones_spec.rb +109 -2
- data/spec/extensions/pg_auto_constraint_validations_spec.rb +45 -0
- data/spec/extensions/pg_json_spec.rb +218 -29
- data/spec/extensions/pg_range_spec.rb +76 -9
- data/spec/extensions/rcte_tree_spec.rb +6 -0
- data/spec/extensions/s_spec.rb +1 -1
- data/spec/extensions/schema_dumper_spec.rb +4 -2
- data/spec/extensions/server_block_spec.rb +38 -0
- data/spec/extensions/spec_helper.rb +8 -1
- data/spec/extensions/static_cache_cache_spec.rb +35 -0
- data/spec/integration/dataset_test.rb +25 -9
- data/spec/integration/plugin_test.rb +42 -0
- data/spec/integration/schema_test.rb +7 -2
- data/spec/integration/transaction_test.rb +50 -0
- data/spec/model/associations_spec.rb +84 -4
- data/spec/model/plugins_spec.rb +111 -0
- metadata +16 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7ea0327d7fbbc76458fc9dc6a088069f04bd100b37f91288e9db9f37db84bbb7
|
|
4
|
+
data.tar.gz: 6195027a34de796b5109ee2b2ed57407ce9a58f75b1661a3be0ab9b2acbba885
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aaa9a71ee0562ccedaeee6144c4764a8024699214dfd4fd7ce46e8a301d8df72f1a709d373f7f5d47c455ff70407b61e1e0bf05ee7f30e20c49a3be51a1bbea2
|
|
7
|
+
data.tar.gz: d8343280ef3c09e930df1db0e12eeac349ce23f396fccf1dfcc055a5e760d5dbb50fd5d0a4f8ce591ac4d12644833b9afea6a94fa1b52991c580baba28c26926
|
data/CHANGELOG
CHANGED
|
@@ -1,3 +1,105 @@
|
|
|
1
|
+
=== 5.24.0 (2019-09-01)
|
|
2
|
+
|
|
3
|
+
* Add Database#skip_logging? private method designed for extensions to force query timing even if no logger is present (adam12) (#1640)
|
|
4
|
+
|
|
5
|
+
* Allow a hostname specified in a defaults_file in the mysql2 adapter, by not explicitly setting :host (sapio-bdeamer) (#1638)
|
|
6
|
+
|
|
7
|
+
* Convert all database array types to Ruby arrays in the jdbc adapter (jeremyevans)
|
|
8
|
+
|
|
9
|
+
* Add static_cache_cache plugin for caching rows for static_cache models to a file to avoid database queries during model initialization (jeremyevans)
|
|
10
|
+
|
|
11
|
+
* Add :cache_file plugin option to pg_auto_constraint_validations plugin, for caching metadata to a file for faster initialization (jeremyevans)
|
|
12
|
+
|
|
13
|
+
* Support :unique_deferrable and :primary_key_deferrable column options (jeremyevans)
|
|
14
|
+
|
|
15
|
+
* Support :generated_always_as column option on PostgreSQL 12+ (jeremyevans)
|
|
16
|
+
|
|
17
|
+
=== 5.23.0 (2019-08-01)
|
|
18
|
+
|
|
19
|
+
* Work around a bug on jdbc-sqlite3 3.27.2.1 when parsing schema for tables with columns with default values (jeremyevans)
|
|
20
|
+
|
|
21
|
+
* Work around a bug in jdbc-sqlite3 3.27.2.1 when in Database#foreign_key_list in the jdbc/sqlite3 adapter (jeremyevans)
|
|
22
|
+
|
|
23
|
+
* Make Dataset#execute* private methods respect explicit servers option, fixing Dataset#paged_each in the postgres adapter when sharding (jeremyevans) (#1632)
|
|
24
|
+
|
|
25
|
+
* Handle instances of subclasses of core classes when wrapping objects in the pg_json extension (jeremyevans) (#1631)
|
|
26
|
+
|
|
27
|
+
* Support :ansi Database option in the tinytds adapter (kenaniah) (#1629)
|
|
28
|
+
|
|
29
|
+
* Support cross-database and linked servers when parsing schema on Microsoft SQL Server (kenaniah) (#1629)
|
|
30
|
+
|
|
31
|
+
* Add insert_conflict plugin for automatically handling unique constraint conflicts when saving new model instances on PostgreSQL 9.5+ and SQLite 3.24.0+ (jeremyevans)
|
|
32
|
+
|
|
33
|
+
* Avoid errors when parsing schema in the mock sqlite adapter (jeremyevans)
|
|
34
|
+
|
|
35
|
+
* Avoid possible thread-safety issue in the timezones support (jeremyevans)
|
|
36
|
+
|
|
37
|
+
* Handle offsets when typecasting an array or hash to datetime when Sequel.datetime_class = Time (jeremyevans)
|
|
38
|
+
|
|
39
|
+
* Support Sequel.datetime_class = Time when using the named_timezones extension (jeremyevans)
|
|
40
|
+
|
|
41
|
+
=== 5.22.0 (2019-07-01)
|
|
42
|
+
|
|
43
|
+
* Fix Dataset#multi_insert and #import with return: :primary_key on MSSQL when the dataset has a row_proc (jeremyevans) (#1627)
|
|
44
|
+
|
|
45
|
+
* Support Dataset#with :materialized option on PostgreSQL 12 for [NOT] MATERIALIZED (jeremyevans)
|
|
46
|
+
|
|
47
|
+
* Make Database#primary_key_sequence work on tables without serial sequences on PostgreSQL 12 (jeremyevans)
|
|
48
|
+
|
|
49
|
+
* Support ruby 2.7+ startless ranges in the pg_range extension (jeremyevans)
|
|
50
|
+
|
|
51
|
+
* Support ruby 2.7+ startless, endless ranges in filters, using an always true condition for them (jeremyevans)
|
|
52
|
+
|
|
53
|
+
* Support ruby 2.7+ startless ranges in filters, using just a <= or < operator for them (jeremyevans)
|
|
54
|
+
|
|
55
|
+
=== 5.21.0 (2019-06-01)
|
|
56
|
+
|
|
57
|
+
* Recognize additional DatabaseLockTimeout errors in mysql and mysql2 adapters (jeremyevans)
|
|
58
|
+
|
|
59
|
+
* Disallow eager_graph of ancestors and descendants associations when using the rcte_tree plugin (jeremyevans)
|
|
60
|
+
|
|
61
|
+
* Make jdbc/mysql adapter work when using JRuby with Java 11 (jeremyevans)
|
|
62
|
+
|
|
63
|
+
* Support window function options :window, :exclude, and :frame :type=>:groups, :start, and :end on SQLite 3.28.0+ (jeremyevans)
|
|
64
|
+
|
|
65
|
+
* Make the server_block extension respect the :servers_hash Database option (jeremyevans)
|
|
66
|
+
|
|
67
|
+
* Typecast string input for json/jsonb types as JSON strings instead of parsing as JSON in the pg_json extension when Database#typecast_json_strings is set to true (jeremyevans)
|
|
68
|
+
|
|
69
|
+
* Wrap JSON primitives (string, number, true, false, nil) in the pg_json extension when Database#wrap_json_primitives is set to true (jeremyevans)
|
|
70
|
+
|
|
71
|
+
* Convert the Database :timeout option to an integer in the sqlite adapter (jeremyevans) (#1620)
|
|
72
|
+
|
|
73
|
+
* Improve performance in ado adapter using more efficient inner loop (jeremyevans)
|
|
74
|
+
|
|
75
|
+
* Improve performance in ado adapter using faster callables for type conversion (jeremyevans)
|
|
76
|
+
|
|
77
|
+
* Fix handling of decimal values in the ado adapter when using locales where the decimal separator is , and not . (jeremyevans) (#1619)
|
|
78
|
+
|
|
79
|
+
=== 5.20.0 (2019-05-01)
|
|
80
|
+
|
|
81
|
+
* Fix reversing of alter_table add_foreign_key when :type option is used (jeremyevans) (#1615)
|
|
82
|
+
|
|
83
|
+
* Switch from using instance_exec to define_method for model associations and in some plugins (jeremyevans)
|
|
84
|
+
|
|
85
|
+
* Fix Database#server_version when using mysql2 adapter with mysql driver on MariaDB 10+ database (v-kolesnikov) (#1614)
|
|
86
|
+
|
|
87
|
+
* Make one_to_one setter method handle models that use joined datasets (jeremyevans) (#1612)
|
|
88
|
+
|
|
89
|
+
* Make auto_validations plugin work with the class_table_inheritance plugin (jeremyevans) (#1611)
|
|
90
|
+
|
|
91
|
+
* Avoid use of instance_exec for PlaceholderLiteralString#with_dataset (jeremyevans)
|
|
92
|
+
|
|
93
|
+
* Recognize float unsigned database types as float (keeguon, jeremyevans) (#1609)
|
|
94
|
+
|
|
95
|
+
* Support :savepoint options to Database#{after_commit,after_rollback} for making the hooks handle savepoints (jeremyevans)
|
|
96
|
+
|
|
97
|
+
* Avoid use of instance_exec in association_dependencies plugin (jeremyevans)
|
|
98
|
+
|
|
99
|
+
* Add pg_auto_constraint_validation_override to the pg_auto_constraint_validations plugin, for customizing columns and error message per constraint (jeremyevans)
|
|
100
|
+
|
|
101
|
+
* Make Database#check_constraints on PostgreSQL also include constraints where the related columns are not known (jeremyevans)
|
|
102
|
+
|
|
1
103
|
=== 5.19.0 (2019-04-02)
|
|
2
104
|
|
|
3
105
|
* Use more optimized approach to merging hashes in ruby 2.5+ (jeremyevans)
|
data/doc/dataset_filtering.rdoc
CHANGED
|
@@ -106,6 +106,21 @@ You can also use placeholders with :placeholder and a hash of placeholder values
|
|
|
106
106
|
items.where(Sequel.lit('category = :category', category: "ruby")).sql
|
|
107
107
|
# "SELECT * FROM items WHERE category = 'ruby'"
|
|
108
108
|
|
|
109
|
+
In order to combine AND and OR together, you have a few options:
|
|
110
|
+
|
|
111
|
+
items.where(category: nil).or(category: "ruby")
|
|
112
|
+
# SELECT * FROM items WHERE (category IS NULL) OR (category = 'ruby')
|
|
113
|
+
|
|
114
|
+
This won't work if you add other conditions:
|
|
115
|
+
|
|
116
|
+
items.where(name: "Programming in Ruby").where(category: nil).or(category: 'ruby')
|
|
117
|
+
# SELECT * FROM items WHERE ((name = 'Programming in Ruby') AND (category IS NULL)) OR (category = 'ruby')
|
|
118
|
+
|
|
119
|
+
The OR applies globally and not locally. To fix this, use & and |:
|
|
120
|
+
|
|
121
|
+
items.where(Sequel[name: "Programming in Ruby"] & (Sequel[category: nil] | Sequel[category: "ruby"]))
|
|
122
|
+
# SELECT * FROM items WHERE ((name = 'Programming in Ruby') AND ((category IS NULL) OR (category = 'ruby')))
|
|
123
|
+
|
|
109
124
|
=== Specifying SQL functions
|
|
110
125
|
|
|
111
126
|
Sequel also allows you to specify functions by using the Sequel.function method:
|
data/doc/opening_databases.rdoc
CHANGED
|
@@ -264,7 +264,8 @@ The following additional options are supported:
|
|
|
264
264
|
or an array of symbols or strings (e.g. <tt>:sql_mode=>[:no_zero_date, :pipes_as_concat]</tt>).
|
|
265
265
|
:timeout :: Sets the wait_timeout for the connection, defaults to 1 month.
|
|
266
266
|
:read_timeout :: Set the timeout in seconds for reading back results to a query.
|
|
267
|
-
:connect_timeout :: Set the timeout in seconds before a connection attempt is abandoned
|
|
267
|
+
:connect_timeout :: Set the timeout in seconds before a connection attempt is abandoned
|
|
268
|
+
(may not be supported when using MariaDB 10.2+ client libraries).
|
|
268
269
|
|
|
269
270
|
The :sslkey, :sslcert, :sslca, :sslcapath, and :sslca options (in that order) are passed to Mysql#ssl_set method
|
|
270
271
|
if either the :sslca or :sslkey option is given.
|
|
@@ -400,6 +401,9 @@ options that you may want to set are :login_timeout, :timeout, :tds_version, :az
|
|
|
400
401
|
|
|
401
402
|
Other Sequel specific options:
|
|
402
403
|
|
|
404
|
+
:ansi :: Set to true to enable the ANSI compatibility settings when connecting
|
|
405
|
+
(ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ANSI_NULL_DFLT_ON, QUOTED_IDENTIFIER,
|
|
406
|
+
CONCAT_NULL_YIELDS_NULL).
|
|
403
407
|
:server_version :: Override the server version to use (9000000 = SQL Server 2005).
|
|
404
408
|
This also works on any other adapter that connects to Microsoft
|
|
405
409
|
SQL Server.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
= New Features
|
|
2
|
+
|
|
3
|
+
* Database#after_commit and #after_rollback transaction hook methods
|
|
4
|
+
now support a :savepoint option. Using the :savepoint option makes
|
|
5
|
+
the hooks savepoint-aware, so after_commit will only be called if
|
|
6
|
+
all enclosing savepoints and the transaction are committed, and
|
|
7
|
+
after_rollback will be called when any of the enclosing savepoints
|
|
8
|
+
are rolled back (which may be before transaction commit/rollback).
|
|
9
|
+
Examples:
|
|
10
|
+
|
|
11
|
+
x = nil
|
|
12
|
+
DB.transaction do # BEGIN
|
|
13
|
+
DB.transaction(savepoint: true) do # SAVEPOINT
|
|
14
|
+
DB.after_commit(savepoint: true){x = 1}
|
|
15
|
+
DB.after_rollback(savepoint: true){x = 2}
|
|
16
|
+
x # nil
|
|
17
|
+
end # RELEASE SAVEPOINT
|
|
18
|
+
x # nil
|
|
19
|
+
end # COMMIT
|
|
20
|
+
x # 1
|
|
21
|
+
|
|
22
|
+
x = nil
|
|
23
|
+
DB.transaction do # BEGIN
|
|
24
|
+
DB.transaction(savepoint: true) do # SAVEPOINT
|
|
25
|
+
DB.after_commit(savepoint: true){x = 1}
|
|
26
|
+
DB.after_rollback(savepoint: true){x = 2}
|
|
27
|
+
x # nil
|
|
28
|
+
raise Sequel::Rollback
|
|
29
|
+
end # ROLLBACK TO SAVEPOINT
|
|
30
|
+
x # 2
|
|
31
|
+
end # COMMIT
|
|
32
|
+
x # 2
|
|
33
|
+
|
|
34
|
+
x = nil
|
|
35
|
+
DB.transaction do # BEGIN
|
|
36
|
+
DB.transaction(savepoint: true) do # SAVEPOINT
|
|
37
|
+
DB.after_commit(savepoint: true){x = 1}
|
|
38
|
+
DB.after_rollback(savepoint: true){x = 2}
|
|
39
|
+
end # RELEASE SAVEPOINT
|
|
40
|
+
x # nil
|
|
41
|
+
raise Sequel::Rollback
|
|
42
|
+
end
|
|
43
|
+
x # 2
|
|
44
|
+
|
|
45
|
+
* The pg_auto_constraint_validations plugin now supports a
|
|
46
|
+
pg_auto_constraint_validation_override method for overriding
|
|
47
|
+
the columns and message for a specific constraint. This is
|
|
48
|
+
useful if the database cannot determine the columns (due
|
|
49
|
+
to the constraint containing a database function call), or
|
|
50
|
+
if you would like to customize the message per constraint.
|
|
51
|
+
|
|
52
|
+
= Other Improvements
|
|
53
|
+
|
|
54
|
+
* The one_to_one association setter now works with models that use
|
|
55
|
+
joined datasets, such as child models when using the
|
|
56
|
+
class_table_inheritance plugin.
|
|
57
|
+
|
|
58
|
+
* Database#check_constraints on PostgreSQL now also includes CHECK
|
|
59
|
+
constraints where the related columns are not known. The :columns
|
|
60
|
+
entry in the hash will be an empty array in such cases. The
|
|
61
|
+
exclusion of such constraints in previous versions was not
|
|
62
|
+
intentional, and the documentation implied that all CHECK
|
|
63
|
+
constraints were returned.
|
|
64
|
+
|
|
65
|
+
* Many cases where instance_exec was previously used on model
|
|
66
|
+
instances have been changed so that instance methods are defined
|
|
67
|
+
and called instead. This avoids the creation of singleton classes
|
|
68
|
+
for model instances, and can significantly improve performance in
|
|
69
|
+
some cases. This affects all associations as well as the
|
|
70
|
+
following plugins:
|
|
71
|
+
|
|
72
|
+
* composition
|
|
73
|
+
* hook_class_methods
|
|
74
|
+
* validation_class_methods
|
|
75
|
+
|
|
76
|
+
Other cases where instance_exec is now avoided and a different
|
|
77
|
+
approach is used:
|
|
78
|
+
|
|
79
|
+
* association_dependencies plugin
|
|
80
|
+
* PlaceholderLiteralString#with_dataset
|
|
81
|
+
|
|
82
|
+
* The auto_validations plugin now works with child models when using
|
|
83
|
+
the class_table_inheritance plugin.
|
|
84
|
+
|
|
85
|
+
* Database#server_version now works correctly in the mysql2 adapter
|
|
86
|
+
when using the MySQL driver with MariaDB 10+.
|
|
87
|
+
|
|
88
|
+
* The float unsigned type is now recognized and supported in the
|
|
89
|
+
schema parser and schema_dumper extension.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
= New Features
|
|
2
|
+
|
|
3
|
+
* The pg_json extension now adds a Database#wrap_json_primitives
|
|
4
|
+
accessor. When set to true, JSON primitive values (string, number,
|
|
5
|
+
true, false, and null) will be wrapped by delegate Ruby objects
|
|
6
|
+
instead of using Ruby primitives. This allows the values to round
|
|
7
|
+
trip, so the following code will work even for primitive values in
|
|
8
|
+
json_column:
|
|
9
|
+
|
|
10
|
+
DB.extension :pg_json
|
|
11
|
+
DB.wrap_json_primitives = true
|
|
12
|
+
value = DB[:table].get(:json_column)
|
|
13
|
+
DB[:other_table].insert(json_column: value)
|
|
14
|
+
|
|
15
|
+
This should be enabled with care, especially in cases where false
|
|
16
|
+
and null JSON values are used, as the behavior will change if
|
|
17
|
+
the objects are used in a boolean context in Ruby, as only false
|
|
18
|
+
and nil in Ruby are treated as false:
|
|
19
|
+
|
|
20
|
+
# assume JSON false or null value
|
|
21
|
+
value = DB[:table].get(:json_column)
|
|
22
|
+
|
|
23
|
+
if value
|
|
24
|
+
# executed if wrap_json_primitives is true
|
|
25
|
+
else
|
|
26
|
+
# executed by default
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
When typecasting input in model objects to a JSON type, string
|
|
30
|
+
input will still be parsed as JSON. However, you can set the
|
|
31
|
+
Database#typecast_json_strings accessor to true, and then string
|
|
32
|
+
input will be considered as a JSON string instead of parsing the
|
|
33
|
+
string as JSON.
|
|
34
|
+
|
|
35
|
+
To prevent backwards compatibility issues, Sequel.pg_json/pg_jsonb
|
|
36
|
+
behavior has not changed. To support wrapping Ruby primitives in
|
|
37
|
+
the delegate objects, new Sequel.pg_json_wrap/pg_jsonb_wrap methods
|
|
38
|
+
have been added. These methods only handle the Ruby primitives,
|
|
39
|
+
they cannot be used if the existing object is already a delegate
|
|
40
|
+
object.
|
|
41
|
+
|
|
42
|
+
As model objects always consider a nil value as SQL NULL and do
|
|
43
|
+
not typecast it, if you want to explicitly set a JSON null value,
|
|
44
|
+
you need to wrap it explicitly:
|
|
45
|
+
|
|
46
|
+
model_object.json_column = Sequel.pg_json_wrap(nil)
|
|
47
|
+
|
|
48
|
+
= Other Improvements
|
|
49
|
+
|
|
50
|
+
* Sequel now supports window function options :window, :exclude, and
|
|
51
|
+
:frame :type=>:groups, :start, and :end on SQLite 3.28.0+.
|
|
52
|
+
|
|
53
|
+
* The server_block extension now respects the :servers_hash Database
|
|
54
|
+
option. This makes it more similar to Sequel's default behavior.
|
|
55
|
+
However, that means by default, the server_block extension will
|
|
56
|
+
default to handling unknown shards as the default shard, instead
|
|
57
|
+
of raising an error for them.
|
|
58
|
+
|
|
59
|
+
* The rcte_tree plugin now disallows eager graphing of the ancestors
|
|
60
|
+
and descendants associations. Previously, eager graphing of these
|
|
61
|
+
associations generated incorrect results. It is not possible to
|
|
62
|
+
eager graph these extensions, but normal eager loading does work.
|
|
63
|
+
|
|
64
|
+
* The ado adapter's performance has been improved by using faster
|
|
65
|
+
callables for type conversion and a more efficient inner loop.
|
|
66
|
+
|
|
67
|
+
* The sqlite adapter now converts a :timeout option given as a string
|
|
68
|
+
to an integer. This allows you to use the option inside of a
|
|
69
|
+
connection string.
|
|
70
|
+
|
|
71
|
+
* The mysql and mysql2 adapters now recognize an additional
|
|
72
|
+
DatabaseLockTimeout error.
|
|
73
|
+
|
|
74
|
+
* The jdbc/mysql adapter now works correctly when using JRuby with
|
|
75
|
+
Java 11.
|
|
76
|
+
|
|
77
|
+
* The ado adapter now handles numeric values when using locales that
|
|
78
|
+
use comma instead of period as the decimal separator.
|
|
79
|
+
|
|
80
|
+
= Backwards Compatibility
|
|
81
|
+
|
|
82
|
+
* In the pg_json extension, the following singleton methods of
|
|
83
|
+
Sequel::Postgres::JSONDatabaseMethods are now deprecated:
|
|
84
|
+
|
|
85
|
+
* parse_json
|
|
86
|
+
* db_parse_json
|
|
87
|
+
* db_parse_jsonb
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
= New Features
|
|
2
|
+
|
|
3
|
+
* Sequel now supports Ruby 2.7+ startless ranges in filters:
|
|
4
|
+
|
|
5
|
+
DB[:table].where(:column=>(..10))
|
|
6
|
+
# SELECT * FROM table WHERE (column <= 10)
|
|
7
|
+
|
|
8
|
+
DB[:table].where(:column=>(...10))
|
|
9
|
+
# SELECT * FROM table WHERE (column < 10)
|
|
10
|
+
|
|
11
|
+
It also supports startless, endless ranges in filters, using a
|
|
12
|
+
condition that is always true:
|
|
13
|
+
|
|
14
|
+
DB[:table].where(:column=>(nil..nil))
|
|
15
|
+
# SELECT * FROM table WHERE (1 = 1)
|
|
16
|
+
|
|
17
|
+
* Sequel now supports startless ranges in the pg_range extension:
|
|
18
|
+
|
|
19
|
+
DB.extension :pg_range
|
|
20
|
+
|
|
21
|
+
DB[:table].insert(:column=>(..10))
|
|
22
|
+
# INSERT INTO "table" ("column") VALUES ('[,10]') RETURNING "id"
|
|
23
|
+
|
|
24
|
+
DB[:table].insert(:column=>(...10))
|
|
25
|
+
# INSERT INTO "table" ("column") VALUES ('[,10)') RETURNING "id"
|
|
26
|
+
|
|
27
|
+
DB[:table].insert(:column=>(nil..nil))
|
|
28
|
+
# INSERT INTO "table" ("column") VALUES ('[,]') RETURNING "id"
|
|
29
|
+
|
|
30
|
+
* Sequel now supports a :materialized option in Dataset#with on
|
|
31
|
+
PostgreSQL 12+, to control the inlining of common table expressions:
|
|
32
|
+
|
|
33
|
+
DB[:t].with(:t, DB[:t2], :materialized=>false)
|
|
34
|
+
# WITH "t" AS NOT MATERIALIZED (SELECT * FROM "t2")
|
|
35
|
+
# SELECT * FROM "t"
|
|
36
|
+
|
|
37
|
+
DB[:t].with(:t, DB[:t2], :materialized=>true)
|
|
38
|
+
# WITH "t" AS MATERIALIZED (SELECT * FROM "t2")
|
|
39
|
+
# SELECT * FROM "t"
|
|
40
|
+
|
|
41
|
+
= Other Improvements
|
|
42
|
+
|
|
43
|
+
* Database#primary_key_sequence now works for tables without serial
|
|
44
|
+
sequences on PostgreSQL 12+.
|
|
45
|
+
|
|
46
|
+
* Dataset#multi_insert and #import with return: :primary_key option
|
|
47
|
+
on Microsoft SQL Server now work correctly if the dataset uses
|
|
48
|
+
a row_proc (e.g. for model datasets).
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
= New Features
|
|
2
|
+
|
|
3
|
+
* An insert_conflict plugin has been added for automatically handling
|
|
4
|
+
constraint conflicts when saving new model instances. It is
|
|
5
|
+
supported on PostgreSQL 9.5+ and SQLite 3.24.0+.
|
|
6
|
+
|
|
7
|
+
Album.new(name: 'Foo', copies_sold: 1000).
|
|
8
|
+
insert_conflict(
|
|
9
|
+
target: :name,
|
|
10
|
+
update: {copies_sold: Sequel[:excluded][:b]}
|
|
11
|
+
).
|
|
12
|
+
save
|
|
13
|
+
|
|
14
|
+
* On Microsoft SQL Server, the Database :ansi option has been added,
|
|
15
|
+
which sets the following ANSI related options:
|
|
16
|
+
|
|
17
|
+
* ANSI_NULLS
|
|
18
|
+
* ANSI_PADDING
|
|
19
|
+
* ANSI_WARNINGS
|
|
20
|
+
* ANSI_NULL_DFLT_ON
|
|
21
|
+
* QUOTED_IDENTIFIER
|
|
22
|
+
* CONCAT_NULL_YIELDS_NULL
|
|
23
|
+
|
|
24
|
+
= Other Improvements
|
|
25
|
+
|
|
26
|
+
* Sequel.datetime_class = Time is now supported when using the
|
|
27
|
+
named_timezones extension. For backwards compatibility, the
|
|
28
|
+
named_timezones extension still sets
|
|
29
|
+
Sequel.datetime_class = DateTime. When using Ruby 2.6+, the
|
|
30
|
+
Time instances have the timezone set on them using Ruby 2.6+'s
|
|
31
|
+
timezone support, but basic support works correctly in earlier
|
|
32
|
+
versions of Ruby.
|
|
33
|
+
|
|
34
|
+
* On Microsoft SQL Server, Sequel now handles parsing schema for
|
|
35
|
+
tables in another database on the same server or in a database
|
|
36
|
+
on a linked server.
|
|
37
|
+
|
|
38
|
+
* The pg_json extension now correctly handles subclasses of core
|
|
39
|
+
classes when wrapping objects. This stopped working in Sequel
|
|
40
|
+
5.21.0, when support for wrapping JSON primitives was added.
|
|
41
|
+
|
|
42
|
+
* Sequel now works around a couple bugs in jdbc-sqlite 3.27.2.1,
|
|
43
|
+
allowing schema parsing and foreign key parsing to work.
|
|
44
|
+
|
|
45
|
+
* Dataset#execute* private methods now respect an explicitly given
|
|
46
|
+
:server option, fixing Dataset#paged_each in the postgres adapter
|
|
47
|
+
when using sharding.
|
|
48
|
+
|
|
49
|
+
* Timezone offsets are now handled correctly when typecasting an array
|
|
50
|
+
or hash to datetime when Sequel.datetime_class = Time.
|
|
51
|
+
|
|
52
|
+
* Sequel now avoids errors when parsing schema when using the mock
|
|
53
|
+
SQLite adapter.
|
|
54
|
+
|
|
55
|
+
* A minor thread-safety issue has been fixed in the named_timezones
|
|
56
|
+
extension.
|
|
@@ -0,0 +1,56 @@
|
|
|
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.
|