sequel 5.36.0 → 5.41.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 +56 -0
- data/MIT-LICENSE +1 -1
- data/README.rdoc +1 -1
- data/doc/cheat_sheet.rdoc +5 -5
- data/doc/code_order.rdoc +0 -12
- data/doc/fork_safety.rdoc +84 -0
- data/doc/opening_databases.rdoc +5 -1
- data/doc/postgresql.rdoc +1 -1
- data/doc/querying.rdoc +3 -3
- data/doc/release_notes/5.37.0.txt +30 -0
- data/doc/release_notes/5.38.0.txt +28 -0
- data/doc/release_notes/5.39.0.txt +19 -0
- data/doc/release_notes/5.40.0.txt +40 -0
- data/doc/release_notes/5.41.0.txt +25 -0
- data/doc/sql.rdoc +1 -1
- data/doc/transactions.rdoc +0 -8
- data/lib/sequel/adapters/jdbc.rb +15 -3
- data/lib/sequel/adapters/jdbc/mysql.rb +4 -4
- data/lib/sequel/adapters/shared/mssql.rb +21 -1
- data/lib/sequel/adapters/shared/oracle.rb +1 -1
- data/lib/sequel/adapters/shared/postgres.rb +6 -4
- data/lib/sequel/adapters/shared/sqlite.rb +35 -1
- data/lib/sequel/core.rb +5 -6
- data/lib/sequel/database/connecting.rb +0 -1
- data/lib/sequel/database/misc.rb +14 -0
- data/lib/sequel/database/schema_generator.rb +6 -0
- data/lib/sequel/database/schema_methods.rb +16 -6
- data/lib/sequel/database/transactions.rb +1 -1
- data/lib/sequel/dataset/actions.rb +10 -6
- data/lib/sequel/dataset/features.rb +10 -0
- data/lib/sequel/dataset/prepared_statements.rb +2 -0
- data/lib/sequel/dataset/sql.rb +32 -10
- data/lib/sequel/extensions/blank.rb +8 -0
- data/lib/sequel/extensions/date_arithmetic.rb +8 -9
- data/lib/sequel/extensions/eval_inspect.rb +2 -0
- data/lib/sequel/extensions/inflector.rb +8 -0
- data/lib/sequel/extensions/migration.rb +9 -1
- data/lib/sequel/extensions/named_timezones.rb +5 -1
- data/lib/sequel/extensions/pg_array.rb +1 -0
- data/lib/sequel/extensions/pg_interval.rb +34 -8
- data/lib/sequel/extensions/pg_row.rb +1 -0
- data/lib/sequel/extensions/pg_row_ops.rb +24 -0
- data/lib/sequel/extensions/query.rb +2 -0
- data/lib/sequel/extensions/schema_dumper.rb +3 -3
- data/lib/sequel/model/associations.rb +28 -4
- data/lib/sequel/model/base.rb +21 -4
- data/lib/sequel/model/plugins.rb +5 -0
- data/lib/sequel/plugins/association_proxies.rb +2 -0
- data/lib/sequel/plugins/auto_validations.rb +15 -1
- data/lib/sequel/plugins/class_table_inheritance.rb +0 -5
- data/lib/sequel/plugins/composition.rb +5 -1
- data/lib/sequel/plugins/constraint_validations.rb +2 -1
- data/lib/sequel/plugins/dataset_associations.rb +4 -1
- data/lib/sequel/plugins/dirty.rb +44 -0
- data/lib/sequel/plugins/nested_attributes.rb +3 -1
- data/lib/sequel/plugins/pg_array_associations.rb +4 -0
- data/lib/sequel/plugins/pg_auto_constraint_validations.rb +2 -0
- data/lib/sequel/plugins/single_table_inheritance.rb +7 -0
- data/lib/sequel/plugins/tree.rb +9 -4
- data/lib/sequel/plugins/validation_helpers.rb +6 -2
- data/lib/sequel/timezones.rb +8 -3
- data/lib/sequel/version.rb +1 -1
- metadata +33 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0886ae2f4e4f4490b56ced6137e2d849cac2458119d6e67d9a756328336ece6
|
4
|
+
data.tar.gz: 9c4946c8ca82b2b1c99ee9065bef0aa81175128564cd7ab0c0405bd4e682b339
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa61ea3a0cb3d0e3ab021d27589e10250ed9d9d5a0b4bf314729d55661624161cabffe9c87278761890a900949756e185ce1f263bf742d9b317f2621a1f75c09
|
7
|
+
data.tar.gz: a8253ea1f6e77b592eb40de7b2544b7b34ff8cd02a79e4dfe5bb26b796dd80d49f052e307590af71fb67b292bc9b9c1def8f400eea0977fdb0d85928a6e9f181
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,59 @@
|
|
1
|
+
=== 5.41.0 (2021-02-01)
|
2
|
+
|
3
|
+
* Have explicit :text option for a String column take priority over :size option on PostgreSQL (jeremyevans) (#1750)
|
4
|
+
|
5
|
+
* Support a :skip_invalid option in auto_validations plugin for not adding errors to a column that already has an error (jeremyevans)
|
6
|
+
|
7
|
+
* Support a :skip_invalid option in validation_helpers for not adding an error to a column that already has an error (jeremyevans)
|
8
|
+
|
9
|
+
* Support :adder, :remover, and :clearer association options that use keyword arguments in Ruby 2.7+ (jeremyevans)
|
10
|
+
|
11
|
+
* Make pg_interval use the same number of seconds per year and per month as ActiveSupport::Duration when using ActiveSupport 5.1+ (jeremyevans)
|
12
|
+
|
13
|
+
=== 5.40.0 (2021-01-01)
|
14
|
+
|
15
|
+
* Support UPDATE FROM syntax in SQLite 3.33.0+ (jeremyevans)
|
16
|
+
|
17
|
+
* Have pg_interval extension work with ActiveSupport 6.1 (jeremyevans)
|
18
|
+
|
19
|
+
* Have date_arithmetic extension work with ActiveSupport 6.1 (jeremyevans)
|
20
|
+
|
21
|
+
* Avoid method redefinition warnings in verbose warning mode (jeremyevans)
|
22
|
+
|
23
|
+
=== 5.39.0 (2020-12-01)
|
24
|
+
|
25
|
+
* Support :clustered option for primary key and unique constraints on Microsoft SQL Server (jeremyevans)
|
26
|
+
|
27
|
+
* Do not modify the size of binary columns when using set_column_allow_null on Microsoft SQL Server (jeremyevans) (#1736)
|
28
|
+
|
29
|
+
* Add a fork safety guide with more detail on how to use Sequel with libraries that fork (janko) (#1733)
|
30
|
+
|
31
|
+
* Make the roots_dataset method in the tree plugin work with queries using joins (jeremyevans) (#1731)
|
32
|
+
|
33
|
+
* Make Database#tables return partitioned tables on PostgreSQL 10+ (epoberezhny) (#1729, #1730)
|
34
|
+
|
35
|
+
=== 5.38.0 (2020-11-01)
|
36
|
+
|
37
|
+
* Do not add new Database instances to Sequel::DATABASES if the test connection fails (jeremyevans) (#1727)
|
38
|
+
|
39
|
+
* Support the newer com.mysql.cj.jdbc.Driver in the jdbc/mysql adapter (jeremyevans)
|
40
|
+
|
41
|
+
* Do not swallow disconnect errors in Database#create_or_replace_view or Database#create_table* on Oracle (jeremyevans)
|
42
|
+
|
43
|
+
* Only rescue non-disconnect Sequel::DatabaseErrors in Postgres::Database#server_version (jeremyevans) (#1724)
|
44
|
+
|
45
|
+
* Make the single_table_inheritance and prepared_statements plugins work if loaded into the same class (jeremyevans) (#1721)
|
46
|
+
|
47
|
+
=== 5.37.0 (2020-10-01)
|
48
|
+
|
49
|
+
* Recognize more unsigned decimal/float types in the schema dumper (akimd, jeremyevans) (#1720)
|
50
|
+
|
51
|
+
* Add Postgres::PGRow::{Array,Hash}Row#op to the pg_row_ops extension if the pg_row extension is loaded (jeremyevans)
|
52
|
+
|
53
|
+
* Add Model#column_previously_was and #column_previously_changed? to the dirty plugin (jeremyevans)
|
54
|
+
|
55
|
+
* Raise Migrator::Error if attempting to migrate down to a version where there are necessary migration files missing (jeremyevans) (#1716)
|
56
|
+
|
1
57
|
=== 5.36.0 (2020-09-01)
|
2
58
|
|
3
59
|
* Handle passing keyword arguments through class methods defined via Plugins.def_dataset_method on Ruby 2.7+ (jeremyevans)
|
data/MIT-LICENSE
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
Copyright (c) 2007-2008 Sharon Rosner
|
2
|
-
Copyright (c) 2008-
|
2
|
+
Copyright (c) 2008-2021 Jeremy Evans
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
of this software and associated documentation files (the "Software"), to
|
data/README.rdoc
CHANGED
@@ -883,7 +883,7 @@ raise an error by default:
|
|
883
883
|
== Sequel Release Policy
|
884
884
|
|
885
885
|
New major versions of Sequel do not have a defined release policy, but historically have
|
886
|
-
occurred once
|
886
|
+
occurred once every few years.
|
887
887
|
|
888
888
|
New minor versions of Sequel are released around once a month near the start of the month.
|
889
889
|
|
data/doc/cheat_sheet.rdoc
CHANGED
@@ -95,18 +95,18 @@ Without a filename argument, the sqlite adapter will setup a new sqlite database
|
|
95
95
|
|
96
96
|
=== AND/OR/NOT
|
97
97
|
|
98
|
-
DB[:items].where{(x > 5) & (y > 10)}
|
98
|
+
DB[:items].where{(x > 5) & (y > 10)}
|
99
99
|
# SELECT * FROM items WHERE ((x > 5) AND (y > 10))
|
100
100
|
|
101
|
-
DB[:items].where(Sequel.or(x: 1, y: 2) & Sequel.~(z: 3))
|
101
|
+
DB[:items].where(Sequel.or(x: 1, y: 2) & Sequel.~(z: 3))
|
102
102
|
# SELECT * FROM items WHERE (((x = 1) OR (y = 2)) AND (z != 3))
|
103
103
|
|
104
104
|
=== Mathematical operators
|
105
105
|
|
106
|
-
DB[:items].where{x + y > z}
|
106
|
+
DB[:items].where{x + y > z}
|
107
107
|
# SELECT * FROM items WHERE ((x + y) > z)
|
108
108
|
|
109
|
-
DB[:items].where{price - 100 < avg(price)}
|
109
|
+
DB[:items].where{price - 100 < avg(price)}
|
110
110
|
# SELECT * FROM items WHERE ((price - 100) < avg(price))
|
111
111
|
|
112
112
|
=== Raw SQL Fragments
|
@@ -130,7 +130,7 @@ Without a filename argument, the sqlite adapter will setup a new sqlite database
|
|
130
130
|
|
131
131
|
== Joins
|
132
132
|
|
133
|
-
DB[:items].left_outer_join(:categories, id: :category_id)
|
133
|
+
DB[:items].left_outer_join(:categories, id: :category_id)
|
134
134
|
# SELECT * FROM items
|
135
135
|
# LEFT OUTER JOIN categories ON categories.id = items.category_id
|
136
136
|
|
data/doc/code_order.rdoc
CHANGED
@@ -100,15 +100,3 @@ and freezing them can easily be achieved through the plugin:
|
|
100
100
|
# ... setup models
|
101
101
|
# Now finalize associations & freeze models by calling the plugin:
|
102
102
|
Sequel::Model.freeze_descendents
|
103
|
-
|
104
|
-
== Disconnect If Using Forking Webserver with Code Preloading
|
105
|
-
|
106
|
-
If you are using a forking webserver such as unicorn or passenger, with
|
107
|
-
a feature that loads your Sequel code before forking connections (code
|
108
|
-
preloading), then you must disconnect your database connections before
|
109
|
-
forking. If you don't do this, you can end up with child processes
|
110
|
-
sharing database connections and all sorts of weird behavior. Sequel
|
111
|
-
will automatically reconnect on an as needed basis in the child
|
112
|
-
processes, so you only need to do the following in the parent process:
|
113
|
-
|
114
|
-
DB.disconnect
|
@@ -0,0 +1,84 @@
|
|
1
|
+
= Fork Safety
|
2
|
+
|
3
|
+
If you are forking or using a library that forks after you have created a
|
4
|
+
Sequel::Database instance, then you must disconnect database connections before forking. If you
|
5
|
+
don't do this, you can end up with child processes sharing database connections
|
6
|
+
and all sorts of weird behavior, including crashes. Sequel will automatically create new
|
7
|
+
connections on an as needed basis in the child processes, so you only need to do the following in
|
8
|
+
the parent process:
|
9
|
+
|
10
|
+
DB.disconnect
|
11
|
+
|
12
|
+
Or if you have connections to multiple databases:
|
13
|
+
|
14
|
+
Sequel::DATABASES.each(&:disconnect)
|
15
|
+
|
16
|
+
== Puma
|
17
|
+
|
18
|
+
When using the Puma web server in clustered mode (which is the default behavior in Puma 5+ when
|
19
|
+
using multiple processes), you should disconnect inside the +before_fork+ hook in your
|
20
|
+
Puma config:
|
21
|
+
|
22
|
+
before_fork do
|
23
|
+
Sequel::DATABASES.each(&:disconnect)
|
24
|
+
end
|
25
|
+
|
26
|
+
== Unicorn
|
27
|
+
|
28
|
+
When using the Unicorn web server and preloading the application (+preload_app true+ in the Unicorn
|
29
|
+
config), you should disconnect inside the +before_fork+ hook in the Unicorn config:
|
30
|
+
|
31
|
+
before_fork do
|
32
|
+
Sequel::DATABASES.each(&:disconnect)
|
33
|
+
end
|
34
|
+
|
35
|
+
== Passenger
|
36
|
+
|
37
|
+
In Passenger web server, you should disconnect inside the
|
38
|
+
+starting_worker_process+ event hook:
|
39
|
+
|
40
|
+
if defined?(PhusionPassenger)
|
41
|
+
PhusionPassenger.on_event(:starting_worker_process) do |forked|
|
42
|
+
Sequel::DATABASES.each(&:disconnect) if forked
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
Note that this disconnects after forking instead of before forking. Passenger does not
|
47
|
+
offer a before fork hook.
|
48
|
+
|
49
|
+
== Spring
|
50
|
+
|
51
|
+
In Spring application preloader, you should disconnect inside the +after_fork+ hook:
|
52
|
+
|
53
|
+
if defined?(Spring)
|
54
|
+
Spring.after_fork do
|
55
|
+
Sequel::DATABASES.each(&:disconnect)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
As the method indicates, this disconnects after forking instead of before forking.
|
60
|
+
Spring does not offer a before fork hook.
|
61
|
+
|
62
|
+
== Resque
|
63
|
+
|
64
|
+
In Resque, you should disconnect inside the +before_fork+ hook:
|
65
|
+
|
66
|
+
Resque.before_fork do |job|
|
67
|
+
Sequel::DATABASES.each(&:disconnect)
|
68
|
+
end
|
69
|
+
|
70
|
+
== Parallel
|
71
|
+
|
72
|
+
If you're using the Parallel gem with processes, you should disconnect before
|
73
|
+
calling it:
|
74
|
+
|
75
|
+
Sequel::DATABASES.each(&:disconnect)
|
76
|
+
Parallel.map(['a','b','c'], in_processes: 3) { |one_letter| }
|
77
|
+
|
78
|
+
== Other Libraries Calling fork
|
79
|
+
|
80
|
+
For any other library that calls fork, you should disconnect before calling
|
81
|
+
a method that forks:
|
82
|
+
|
83
|
+
Sequel::DATABASES.each(&:disconnect)
|
84
|
+
SomeLibrary.method_that_forks
|
data/doc/opening_databases.rdoc
CHANGED
@@ -208,7 +208,7 @@ Example connection strings:
|
|
208
208
|
|
209
209
|
jdbc:sqlite::memory:
|
210
210
|
jdbc:postgresql://localhost/database?user=username
|
211
|
-
jdbc:mysql://localhost/test?user=root&password=root
|
211
|
+
jdbc:mysql://localhost/test?user=root&password=root&serverTimezone=UTC
|
212
212
|
jdbc:h2:mem:
|
213
213
|
jdbc:hsqldb:mem:mymemdb
|
214
214
|
jdbc:derby:memory:myDb;create=true
|
@@ -240,6 +240,10 @@ The following additional options are supported:
|
|
240
240
|
There are a few issues with specific jdbc driver gems:
|
241
241
|
|
242
242
|
jdbc-h2 :: jdbc-h2 versions greater than 1.3.175 have issues with ORDER BY not working correctly in some cases.
|
243
|
+
jdbc-mysql :: Depending on the configuration of the MySQL server, jdbc-mysql versions greater 8 may complain
|
244
|
+
about the server time zone being unrecognized. You can either use an older jdbc-mysql version,
|
245
|
+
or you can specify the +serverTimezone+ option in the connection string, as shown in the example
|
246
|
+
jdbc:mysql connection string above.
|
243
247
|
|
244
248
|
=== mysql
|
245
249
|
|
data/doc/postgresql.rdoc
CHANGED
@@ -213,7 +213,7 @@ other tables. Support may be added in the future.
|
|
213
213
|
=== Creating Unlogged Tables
|
214
214
|
|
215
215
|
PostgreSQL allows users to create unlogged tables, which are faster but not crash safe. Sequel
|
216
|
-
allows you
|
216
|
+
allows you to create an unlogged table by specifying the <tt>unlogged: true</tt> option to +create_table+:
|
217
217
|
|
218
218
|
DB.create_table(:table, unlogged: true){Integer :i}
|
219
219
|
# CREATE UNLOGGED TABLE "table" ("i" integer)
|
data/doc/querying.rdoc
CHANGED
@@ -746,7 +746,7 @@ shortcuts for all common (and most uncommon) join types. For example
|
|
746
746
|
|
747
747
|
Album.join(:artists, id: :artist_id)
|
748
748
|
# SELECT * FROM albums
|
749
|
-
# INNER JOIN artists ON (artists.id = albums.artist_id)
|
749
|
+
# INNER JOIN artists ON (artists.id = albums.artist_id)
|
750
750
|
|
751
751
|
And +left_join+ does a LEFT JOIN:
|
752
752
|
|
@@ -870,14 +870,14 @@ In this case, you don't even need to specify any conditions.
|
|
870
870
|
==== Join Blocks
|
871
871
|
|
872
872
|
You can provide a block to any of the join methods that accept
|
873
|
-
conditions. This block should accept 3 arguments
|
873
|
+
conditions. This block should accept 3 arguments: the table alias
|
874
874
|
for the table currently being joined, the table alias for the last
|
875
875
|
table joined (or first table), and an array of previous
|
876
876
|
<tt>Sequel::SQL::JoinClause</tt>s.
|
877
877
|
|
878
878
|
This allows you to qualify columns similar to how the implicit
|
879
879
|
qualification works, without worrying about the specific aliases
|
880
|
-
being used. For example,
|
880
|
+
being used. For example, let's say you wanted to join the albums
|
881
881
|
and artists tables, but only want albums where the artist's name
|
882
882
|
comes before the album's name.
|
883
883
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* Model#column_previously_was and #column_previously_changed? have
|
4
|
+
been added to the dirty plugin, for getting the previous values
|
5
|
+
of the column before saving and for whether there were changes
|
6
|
+
before saving.
|
7
|
+
|
8
|
+
Model#column_previously_changed? accepts :from and :to options
|
9
|
+
to allow you to more easily determine if the value changed from
|
10
|
+
and/or to specific values.
|
11
|
+
|
12
|
+
This information was previously obtainable via
|
13
|
+
Model#previous_changes, but these new methods offer a friendlier
|
14
|
+
interface.
|
15
|
+
|
16
|
+
* Postgres::PGRow::{Array,Hash}Row#op has been added to the
|
17
|
+
pg_row_ops extension if the pg_row extension is loaded. This
|
18
|
+
is similar to how the pg_array_ops, pg_hstore_ops, and
|
19
|
+
pg_json_ops and #op method to their objects. This makes it
|
20
|
+
easier to perform row operations on literal rows.
|
21
|
+
|
22
|
+
= Other Improvements
|
23
|
+
|
24
|
+
* The schema_dumper extension now supports more unsigned numeric
|
25
|
+
types, such as "decimal(7,2) unsigned" and "real unsigned".
|
26
|
+
|
27
|
+
* IntegerMigrator now raises an Migrator::Error if attempting to
|
28
|
+
migrate down when there are migration files missing and needed for
|
29
|
+
the down migration. Previously, IntegerMigrator would not raise an
|
30
|
+
exception and would make no database changes in this case.
|
@@ -0,0 +1,28 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* The jdbc/mysql adapter now supports the newer
|
4
|
+
com.mysql.cj.jdbc.Driver driver. The adapter will still attempt to
|
5
|
+
load the older com.mysql.jdbc.Driver if the com.mysql.cj.jdbc.Driver
|
6
|
+
is not found.
|
7
|
+
|
8
|
+
= Other Improvements
|
9
|
+
|
10
|
+
* When testing a connection after creating a new Database instance
|
11
|
+
raises an exception, the Database instance is removed from
|
12
|
+
Sequel::DATABASES.
|
13
|
+
|
14
|
+
* The single_table_inheritance and prepared_statements plugins now
|
15
|
+
work correctly if loaded into the same class.
|
16
|
+
|
17
|
+
* Database connect and disconnect errors are no longer swallowed when
|
18
|
+
calling Database#create_or_replace_view, Database#server_version
|
19
|
+
on PostgreSQL, or Database#create_table* on Oracle.
|
20
|
+
|
21
|
+
= Backwards Compatibility
|
22
|
+
|
23
|
+
* Previously, instantiating a new Database instance directly using
|
24
|
+
Sequel::Database.new did not test the connection by default. That
|
25
|
+
was instead handled by Sequel::Database.connect. The test
|
26
|
+
connection now happens inside Database#initialize. This should only
|
27
|
+
affect backwards compatibility for code that is calling
|
28
|
+
Sequel::Database.new directly.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* On Microsoft SQL Server, the :clustered option is now supported
|
4
|
+
for primary key and unique constraints. You can use a true value
|
5
|
+
for CLUSTERED and a false value for NONCLUSTERED.
|
6
|
+
|
7
|
+
= Other Improvements
|
8
|
+
|
9
|
+
* Partitioned tables are now included in the result of
|
10
|
+
Database#tables on PostgreSQL.
|
11
|
+
|
12
|
+
* alter_table set_column_allow_null no longer drops the size of
|
13
|
+
binary columns on Microsoft SQL Server.
|
14
|
+
|
15
|
+
* In the tree plugin, the roots_dataset method now works correctly
|
16
|
+
with queries using joins by qualifying the parent column.
|
17
|
+
|
18
|
+
* A fork safety guide has been added, discussing fork safety issues
|
19
|
+
when using Sequel.
|
@@ -0,0 +1,40 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* On SQLite 3.33.0+, the UPDATE FROM syntax is now supported. This
|
4
|
+
allows you to update one table based on a join to another table.
|
5
|
+
The SQLite syntax is based on the PostgreSQL syntax, and the
|
6
|
+
Sequel API is the same for both. You need to pass multiple tables
|
7
|
+
to Dataset#from. The first table is the table to update, and the
|
8
|
+
remaining tables are used to construct the UPDATE FROM clause:
|
9
|
+
|
10
|
+
DB[:a, :b].where{{a[:c]=>b[:d]}}.update(:e=>'f')
|
11
|
+
# UPDATE a SET e = 'f' FROM b WHERE (a.c = b.d)
|
12
|
+
|
13
|
+
Unlike PostgreSQL, SQLite does not support the deletion of joined
|
14
|
+
datasets. Related to this, the following methods for testing
|
15
|
+
database support for modifying joined datasets have been added:
|
16
|
+
|
17
|
+
* supports_updating_joins?
|
18
|
+
* supports_deleting_joins?
|
19
|
+
|
20
|
+
= Other Improvements
|
21
|
+
|
22
|
+
* The pg_interval and date_arithmetic extensions now support
|
23
|
+
ActiveSupport 6.1.
|
24
|
+
|
25
|
+
* Sequel no longer issues method redefinition warnings in verbose
|
26
|
+
mode. As Ruby 3 has dropped uninitialized instance variable
|
27
|
+
warnings, Sequel is now verbose warning free on Ruby 3.
|
28
|
+
|
29
|
+
= Backwards Compatibility
|
30
|
+
|
31
|
+
* Trying to truncate or insert into a joined dataset now correctly
|
32
|
+
raises an exception even if the joined dataset supports updates.
|
33
|
+
|
34
|
+
* The private Dataset#check_modification_allowed! method is now
|
35
|
+
deprecated, and users (custom adapters) should now switch to one
|
36
|
+
of the more specific methods introduced in this version:
|
37
|
+
|
38
|
+
* check_insert_allowed!
|
39
|
+
* check_update_allowed!
|
40
|
+
* check_delete_allowed!
|
@@ -0,0 +1,25 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* The validation methods added by the validation_helpers plugin now
|
4
|
+
support the :skip_invalid option, which will not add a validation
|
5
|
+
error on a column if it already has a validation error. This can
|
6
|
+
be useful if you want to avoid having duplicate errors.
|
7
|
+
|
8
|
+
* The auto_validations plugin now supports a :skip_invalid plugin
|
9
|
+
option, which will pass the :skip_invalid option when calling
|
10
|
+
validation methods.
|
11
|
+
|
12
|
+
= Other Improvements
|
13
|
+
|
14
|
+
* The :adder, :remover, and :clearer association options now
|
15
|
+
support keyword arguments in Ruby 2.7+.
|
16
|
+
|
17
|
+
* In the pg_interval extension, Sequel now uses the same number of
|
18
|
+
seconds per month and seconds per year as active_support. It
|
19
|
+
originally used the same number, but active_support changed the
|
20
|
+
values in active_support 5.1. Sequel now uses the active_support
|
21
|
+
values if they are available.
|
22
|
+
|
23
|
+
* When adding a String column on PostgreSQL, an explicit text: true
|
24
|
+
option now takes precedence over an explicit :size option, as it
|
25
|
+
does in Sequel's default behavior.
|
data/doc/sql.rdoc
CHANGED
@@ -544,7 +544,7 @@ On some databases, you can specify null ordering:
|
|
544
544
|
|
545
545
|
=== All Columns (.*)
|
546
546
|
|
547
|
-
To select all columns in a table, Sequel supports the * method on identifiers and qualified without an argument:
|
547
|
+
To select all columns in a table, Sequel supports the * method on identifiers and qualified identifiers without an argument:
|
548
548
|
|
549
549
|
Sequel[:table].* # "table".*
|
550
550
|
Sequel[:schema][:table].* # "schema"."table".*
|
data/doc/transactions.rdoc
CHANGED
@@ -143,14 +143,6 @@ If you want the current savepoint to be rolled back when the savepoint block exi
|
|
143
143
|
end # RELEASE SAVEPOINT
|
144
144
|
end # COMMIT
|
145
145
|
|
146
|
-
If you want the current savepoint to be rolled back when the savepoint block exits (even if an exception is not raised), use <tt>Database#rollback_on_exit(:savepoint=>true)</tt>
|
147
|
-
|
148
|
-
DB.transaction do # BEGIN
|
149
|
-
DB.transaction(savepoint: true) do # SAVEPOINT
|
150
|
-
DB.rollback_on_exit(:savepoint=>true)
|
151
|
-
end # ROLLBACK TO SAVEPOINT
|
152
|
-
end # COMMIT
|
153
|
-
|
154
146
|
If you want the current savepoint and potentially enclosing savepoints to be rolled back when the savepoint blocks exit (even if an exception is not raised), use <tt>Database#rollback_on_exit(:savepoint=>integer)</tt>
|
155
147
|
|
156
148
|
DB.transaction do # BEGIN
|