sequel 5.32.0 → 5.33.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 +8 -0
- data/doc/release_notes/5.33.0.txt +24 -0
- data/lib/sequel/adapters/shared/postgres.rb +1 -1
- data/lib/sequel/adapters/shared/sqlite.rb +5 -1
- data/lib/sequel/model/associations.rb +18 -5
- data/lib/sequel/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b83782f79b268011fa8a7dd3af1f6eefc03a92b58ac7f2cf4f3411ee3a0bc16e
|
4
|
+
data.tar.gz: '00679a6acd9fef127e040be0ac93666fdf86f6cdf77d9220168e8b7acf13b069'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3502c155f4bc2a38c799e4e633fdd9267add64b80e35ac9c77d01ade6666d294ccb60e5fe6e438e94bf0b94f16127c7c35da1c37a40272eafd9f025474ec17f
|
7
|
+
data.tar.gz: fd8fde26b14389192787cd59d91def5a9efd4c1b5a8faa2a53c7da16fd479788516a233242548edf0c7901f9080038e9c1a4b967088e7eef4503c82cb153d628
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
=== 5.33.0 (2020-06-01)
|
2
|
+
|
3
|
+
* Support custom join types on a per-association basis when using eager_graph/association_join (jeremyevans)
|
4
|
+
|
5
|
+
* Support primary_key with type: :smallserial on PostgreSQL (j-a-m-l) (#1698)
|
6
|
+
|
7
|
+
* Add Database#current_timestamp_utc accessor on SQLite to keep CURRENT_* in UTC instead of converting to localtime (jeremyevans)
|
8
|
+
|
1
9
|
=== 5.32.0 (2020-05-01)
|
2
10
|
|
3
11
|
* Allow Database#create_table? work with :partition_of option on PostgreSQL (jeremyevans) (#1690)
|
@@ -0,0 +1,24 @@
|
|
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.
|
@@ -950,7 +950,7 @@ module Sequel
|
|
950
950
|
# default value is given.
|
951
951
|
def column_definition_default_sql(sql, column)
|
952
952
|
super
|
953
|
-
if !column[:serial] && !['serial', 'bigserial'].include?(column[:type].to_s) && !column[:default]
|
953
|
+
if !column[:serial] && !['smallserial', 'serial', 'bigserial'].include?(column[:type].to_s) && !column[:default]
|
954
954
|
if (identity = column[:identity])
|
955
955
|
sql << " GENERATED "
|
956
956
|
sql << (identity == :always ? "ALWAYS" : "BY DEFAULT")
|
@@ -38,6 +38,10 @@ module Sequel
|
|
38
38
|
# booleans be stored as integers, but historically Sequel has used 't'/'f'.
|
39
39
|
attr_accessor :integer_booleans
|
40
40
|
|
41
|
+
# Whether to keep CURRENT_TIMESTAMP and similar expressions in UTC. By
|
42
|
+
# default, the expressions are converted to localtime.
|
43
|
+
attr_accessor :current_timestamp_utc
|
44
|
+
|
41
45
|
# A symbol signifying the value of the default transaction mode
|
42
46
|
attr_reader :transaction_mode
|
43
47
|
|
@@ -615,7 +619,7 @@ module Sequel
|
|
615
619
|
# SQLite has CURRENT_TIMESTAMP and related constants in UTC instead
|
616
620
|
# of in localtime, so convert those constants to local time.
|
617
621
|
def constant_sql_append(sql, constant)
|
618
|
-
if c = CONSTANT_MAP[constant]
|
622
|
+
if (c = CONSTANT_MAP[constant]) && !db.current_timestamp_utc
|
619
623
|
sql << c
|
620
624
|
else
|
621
625
|
super
|
@@ -2966,8 +2966,8 @@ module Sequel
|
|
2966
2966
|
# dataset. If that association also has dependent associations, instead of a callable object,
|
2967
2967
|
# use a hash with the callable object being the key, and the dependent association(s) as the value.
|
2968
2968
|
#
|
2969
|
-
# You can specify an alias
|
2970
|
-
# an a Symbol for the
|
2969
|
+
# You can specify an custom alias and/or join type on a per-association basis by providing an
|
2970
|
+
# Sequel::SQL::AliasedExpression object instead of an a Symbol for the association name.
|
2971
2971
|
#
|
2972
2972
|
# Examples:
|
2973
2973
|
#
|
@@ -2983,6 +2983,14 @@ module Sequel
|
|
2983
2983
|
# # FROM albums
|
2984
2984
|
# # LEFT OUTER JOIN artists AS a ON (a.id = albums.artist_id)
|
2985
2985
|
#
|
2986
|
+
# # For each album, eager_graph load the artist, using a specified alias
|
2987
|
+
# # and custom join type
|
2988
|
+
#
|
2989
|
+
# Album.eager_graph(Sequel[:artist].as(:a, join_type: :inner)).all
|
2990
|
+
# # SELECT ...
|
2991
|
+
# # FROM albums
|
2992
|
+
# # INNER JOIN artists AS a ON (a.id = albums.artist_id)
|
2993
|
+
#
|
2986
2994
|
# # For each album, eager_graph load the artist and genre
|
2987
2995
|
# Album.eager_graph(:artist, :genre).all
|
2988
2996
|
# Album.eager_graph(:artist).eager_graph(:genre).all
|
@@ -3125,11 +3133,16 @@ module Sequel
|
|
3125
3133
|
# ta :: table_alias used for the parent association
|
3126
3134
|
# requirements :: an array, used as a stack for requirements
|
3127
3135
|
# r :: association reflection for the current association, or an SQL::AliasedExpression
|
3128
|
-
# with the reflection as the expression
|
3136
|
+
# with the reflection as the expression, the alias base as the alias (or nil to
|
3137
|
+
# use the default alias), and an optional hash with a :join_type entry as the columns
|
3138
|
+
# to use a custom join type.
|
3129
3139
|
# *associations :: any associations dependent on this one
|
3130
3140
|
def eager_graph_association(ds, model, ta, requirements, r, *associations)
|
3131
3141
|
if r.is_a?(SQL::AliasedExpression)
|
3132
3142
|
alias_base = r.alias
|
3143
|
+
if r.columns.is_a?(Hash)
|
3144
|
+
join_type = r.columns[:join_type]
|
3145
|
+
end
|
3133
3146
|
r = r.expression
|
3134
3147
|
else
|
3135
3148
|
alias_base = r[:graph_alias_base]
|
@@ -3152,7 +3165,7 @@ module Sequel
|
|
3152
3165
|
raise Error, "Cannot eager_graph association when :conditions specified and not a hash or an array of pairs. Specify :graph_conditions, :graph_only_conditions, or :graph_block for the association. Model: #{r[:model]}, association: #{r[:name]}"
|
3153
3166
|
end
|
3154
3167
|
|
3155
|
-
ds = loader.call(:self=>ds, :table_alias=>assoc_table_alias, :implicit_qualifier=>(ta == ds.opts[:eager_graph][:master]) ? first_source : qualifier_from_alias_symbol(ta, first_source), :callback=>callback, :join_type=>local_opts[:join_type], :join_only=>local_opts[:join_only], :limit_strategy=>limit_strategy, :from_self_alias=>ds.opts[:eager_graph][:master])
|
3168
|
+
ds = loader.call(:self=>ds, :table_alias=>assoc_table_alias, :implicit_qualifier=>(ta == ds.opts[:eager_graph][:master]) ? first_source : qualifier_from_alias_symbol(ta, first_source), :callback=>callback, :join_type=>join_type || local_opts[:join_type], :join_only=>local_opts[:join_only], :limit_strategy=>limit_strategy, :from_self_alias=>ds.opts[:eager_graph][:master])
|
3156
3169
|
if r[:order_eager_graph] && (order = r.fetch(:graph_order, r[:order]))
|
3157
3170
|
ds = ds.order_append(*qualified_expression(order, assoc_table_alias))
|
3158
3171
|
end
|
@@ -3307,7 +3320,7 @@ module Sequel
|
|
3307
3320
|
end
|
3308
3321
|
end
|
3309
3322
|
|
3310
|
-
SQL::AliasedExpression.new(check_association(model, expr), association.alias)
|
3323
|
+
SQL::AliasedExpression.new(check_association(model, expr), association.alias || expr, association.columns)
|
3311
3324
|
else
|
3312
3325
|
check_association(model, association)
|
3313
3326
|
end
|
data/lib/sequel/version.rb
CHANGED
@@ -6,7 +6,7 @@ module Sequel
|
|
6
6
|
|
7
7
|
# The minor version of Sequel. Bumped for every non-patch level
|
8
8
|
# release, generally around once a month.
|
9
|
-
MINOR =
|
9
|
+
MINOR = 33
|
10
10
|
|
11
11
|
# The tiny version of Sequel. Usually 0, only bumped for bugfix
|
12
12
|
# releases that fix regressions from previous versions.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.33.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -180,6 +180,7 @@ extra_rdoc_files:
|
|
180
180
|
- doc/release_notes/5.30.0.txt
|
181
181
|
- doc/release_notes/5.31.0.txt
|
182
182
|
- doc/release_notes/5.32.0.txt
|
183
|
+
- doc/release_notes/5.33.0.txt
|
183
184
|
files:
|
184
185
|
- CHANGELOG
|
185
186
|
- MIT-LICENSE
|
@@ -233,6 +234,7 @@ files:
|
|
233
234
|
- doc/release_notes/5.30.0.txt
|
234
235
|
- doc/release_notes/5.31.0.txt
|
235
236
|
- doc/release_notes/5.32.0.txt
|
237
|
+
- doc/release_notes/5.33.0.txt
|
236
238
|
- doc/release_notes/5.4.0.txt
|
237
239
|
- doc/release_notes/5.5.0.txt
|
238
240
|
- doc/release_notes/5.6.0.txt
|