-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump sequel from 5.86.0 to 5.87.0 #693
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bumps [sequel](https://github.com/jeremyevans/sequel) from 5.86.0 to 5.87.0. - [Changelog](https://github.com/jeremyevans/sequel/blob/master/CHANGELOG) - [Commits](jeremyevans/sequel@5.86.0...5.87.0) --- updated-dependencies: - dependency-name: sequel dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
gem compare sequel 5.86.0 5.87.0 Compared versions: ["5.86.0", "5.87.0"]
DIFFERENT date:
5.86.0: 2024-11-01 00:00:00 UTC
5.87.0: 2024-12-01 00:00:00 UTC
DIFFERENT rubygems_version:
5.86.0: 3.5.16
5.87.0: 3.5.22
DIFFERENT version:
5.86.0: 5.86.0
5.87.0: 5.87.0
DIFFERENT files:
5.86.0->5.87.0:
* Added:
lib/sequel/extensions/pg_schema_caching.rb +90/-0
lib/sequel/plugins/inspect_pk.rb +44/-0
* Changed:
lib/sequel/adapters/shared/mysql.rb +5/-1
lib/sequel/adapters/shared/postgres.rb +1/-0
lib/sequel/adapters/trilogy.rb +1/-2
lib/sequel/database/misc.rb +6/-2
lib/sequel/dataset/query.rb +7/-3
lib/sequel/extensions/pg_auto_parameterize.rb +1/-1
lib/sequel/extensions/schema_caching.rb +24/-9
lib/sequel/extensions/sqlite_json_ops.rb +1/-1
lib/sequel/model/base.rb +9/-4
lib/sequel/version.rb +1/-1 |
gem compare --diff sequel 5.86.0 5.87.0 Compared versions: ["5.86.0", "5.87.0"]
DIFFERENT files:
5.86.0->5.87.0:
* Added:
lib/sequel/extensions/pg_schema_caching.rb
--- /tmp/20241202-3013-upwlbz 2024-12-02 03:15:59.210674234 +0000
+++ /tmp/d20241202-3013-95f3hp/sequel-5.87.0/lib/sequel/extensions/pg_schema_caching.rb 2024-12-02 03:15:59.162674215 +0000
@@ -0,0 +1,90 @@
+# frozen-string-literal: true
+#
+# The pg_schema_caching extension builds on top of the schema_caching
+# extension, and allows it to handle custom PostgreSQL types. On
+# PostgreSQL, column schema hashes include an :oid entry for the OID
+# for the column's type. For custom types, this OID is dependent on
+# the PostgreSQL database, so in most cases, test and development
+# versions of the same database, created with the same migrations,
+# will have different OIDs.
+#
+# To fix this case, the pg_schema_caching extension removes custom
+# OIDs from the schema cache when dumping the schema, replacing them
+# with a placeholder. When loading the cached schema, the Database
+# object makes a single query to get the OIDs for all custom types
+# used by the cached schema, and it updates all related column
+# schema hashes to set the correct :oid entry for the current
+# database.
+#
+# Related module: Sequel::Postgres::SchemaCaching
+
+require_relative "schema_caching"
+
+module Sequel
+ module Postgres
+ module SchemaCaching
+ include Sequel::SchemaCaching
+
+ private
+
+ # Load custom oids from database when loading schema cache file.
+ def load_schema_cache_file(file)
+ set_custom_oids_for_cached_schema(super)
+ end
+
+ # Find all column schema hashes that use custom types.
+ # Load the oids for custom types in a single query, and update
+ # each related column schema hash with the correct oid.
+ def set_custom_oids_for_cached_schema(schemas)
+ custom_oid_rows = {}
+
+ schemas.each_value do |cols|
+ cols.each do |_, h|
+ if h[:oid] == :custom
+ (custom_oid_rows[h[:db_type]] ||= []) << h
+ end
+ end
+ end
+
+ unless custom_oid_rows.empty?
+ from(:pg_type).where(:typname=>custom_oid_rows.keys).select_hash(:typname, :oid).each do |name, oid|
+ custom_oid_rows.delete(name).each do |row|
+ row[:oid] = oid
+ end
+ end
+ end
+
+ unless custom_oid_rows.empty?
+ warn "Could not load OIDs for the following custom types: #{custom_oid_rows.keys.sort.join(", ")}", uplevel: 3
+
+ schemas.keys.each do |k|
+ if schemas[k].any?{|_,h| h[:oid] == :custom}
+ # Remove schema entry for table, so it will be queried at runtime to get the correct oids
+ schemas.delete(k)
+ end
+ end
+ end
+
+ schemas
+ end
+
+ # Replace :oid entries for custom types with :custom.
+ def dumpable_schema_cache
+ sch = super
+
+ sch.each_value do |cols|
+ cols.each do |_, h|
+ if (oid = h[:oid]) && oid >= 10000
+ h[:oid] = :custom
+ end
+ end
+ end
+
+ sch
+ end
+ end
+ end
+
+ Database.register_extension(:pg_schema_caching, Postgres::SchemaCaching)
+end
+
lib/sequel/plugins/inspect_pk.rb
--- /tmp/20241202-3013-p3tliu 2024-12-02 03:15:59.214674235 +0000
+++ /tmp/d20241202-3013-95f3hp/sequel-5.87.0/lib/sequel/plugins/inspect_pk.rb 2024-12-02 03:15:59.198674230 +0000
@@ -0,0 +1,44 @@
+# frozen-string-literal: true
+
+module Sequel
+ module Plugins
+ # The inspect_pk plugin includes the pk right next to the
+ # model name in inspect, allowing for easily copying and
+ # pasting to retrieve a copy of the object:
+ #
+ # Album.with_pk(1).inspect
+ # # default: #<Album @values={...}>
+ # # with inspect_pk: #<Album[1] @values={...}>
+ #
+ # Usage:
+ #
+ # # Make all model instances include pk in inspect output
+ # Sequel::Model.plugin :inspect_pk
+ #
+ # # Make Album instances include pk in inspect output
+ # Album.plugin :inspect_pk
+ module InspectPk
+ module InstanceMethods
+ private
+
+ # The primary key value to include in the inspect output, if any.
+ # For composite primary keys, this only includes a value if all
+ # fields are present.
+ def inspect_pk
+ if primary_key && (pk = self.pk) && (!(Array === pk) || pk.all?)
+ pk
+ end
+ end
+
+ # Include the instance's primary key in the output.
+ def inspect_prefix
+ if v = inspect_pk
+ "#{super}[#{v.inspect}]"
+ else
+ super
+ end
+ end
+ end
+ end
+ end
+end
* Changed:
lib/sequel/adapters/shared/mysql.rb
--- /tmp/d20241202-3013-95f3hp/sequel-5.86.0/lib/sequel/adapters/shared/mysql.rb 2024-12-02 03:15:59.006674156 +0000
+++ /tmp/d20241202-3013-95f3hp/sequel-5.87.0/lib/sequel/adapters/shared/mysql.rb 2024-12-02 03:15:59.142674208 +0000
@@ -570 +570 @@
- metadata_dataset.with_sql("DESCRIBE ?", table).map do |row|
+ metadata_dataset.with_sql("SHOW FULL COLUMNS FROM ?", table).map do |row|
@@ -579,0 +580,2 @@
+ row[:comment] = row.delete(:Comment)
+ row[:comment] = nil if row[:comment] == ""
@@ -583,0 +586,2 @@
+ row.delete(:Collation)
+ row.delete(:Privileges)
lib/sequel/adapters/shared/postgres.rb
--- /tmp/d20241202-3013-95f3hp/sequel-5.86.0/lib/sequel/adapters/shared/postgres.rb 2024-12-02 03:15:59.010674158 +0000
+++ /tmp/d20241202-3013-95f3hp/sequel-5.87.0/lib/sequel/adapters/shared/postgres.rb 2024-12-02 03:15:59.142674208 +0000
@@ -1077,0 +1078 @@
+ SQL::Function.new(:col_description, pg_class[:oid], pg_attribute[:attnum]).as(:comment),
lib/sequel/adapters/trilogy.rb
--- /tmp/d20241202-3013-95f3hp/sequel-5.86.0/lib/sequel/adapters/trilogy.rb 2024-12-02 03:15:59.010674158 +0000
+++ /tmp/d20241202-3013-95f3hp/sequel-5.87.0/lib/sequel/adapters/trilogy.rb 2024-12-02 03:15:59.142674208 +0000
@@ -65,2 +65 @@
- case exception.message
- when /1205 - Lock wait timeout exceeded; try restarting transaction\z/
+ if exception.error_code == 1205
lib/sequel/database/misc.rb
--- /tmp/d20241202-3013-95f3hp/sequel-5.86.0/lib/sequel/database/misc.rb 2024-12-02 03:15:59.014674159 +0000
+++ /tmp/d20241202-3013-95f3hp/sequel-5.87.0/lib/sequel/database/misc.rb 2024-12-02 03:15:59.146674210 +0000
@@ -249 +248,0 @@
- Sequel.extension(*exts)
@@ -251 +250,6 @@
- if pr = Sequel.synchronize{EXTENSIONS[ext]}
+ unless pr = Sequel.synchronize{EXTENSIONS[ext]}
+ Sequel.extension(ext)
+ pr = Sequel.synchronize{EXTENSIONS[ext]}
+ end
+
+ if pr
lib/sequel/dataset/query.rb
--- /tmp/d20241202-3013-95f3hp/sequel-5.86.0/lib/sequel/dataset/query.rb 2024-12-02 03:15:59.018674161 +0000
+++ /tmp/d20241202-3013-95f3hp/sequel-5.87.0/lib/sequel/dataset/query.rb 2024-12-02 03:15:59.150674212 +0000
@@ -207 +207 @@
- Sequel.extension(*exts)
+ exts.each{|ext| Sequel.extension(ext) unless Sequel.synchronize{EXTENSIONS[ext]}}
@@ -1362 +1361,0 @@
- Sequel.extension(*exts)
@@ -1364 +1363,6 @@
- if pr = Sequel.synchronize{EXTENSIONS[ext]}
+ unless pr = Sequel.synchronize{EXTENSIONS[ext]}
+ Sequel.extension(ext)
+ pr = Sequel.synchronize{EXTENSIONS[ext]}
+ end
+
+ if pr
lib/sequel/extensions/pg_auto_parameterize.rb
--- /tmp/d20241202-3013-95f3hp/sequel-5.86.0/lib/sequel/extensions/pg_auto_parameterize.rb 2024-12-02 03:15:59.106674195 +0000
+++ /tmp/d20241202-3013-95f3hp/sequel-5.87.0/lib/sequel/extensions/pg_auto_parameterize.rb 2024-12-02 03:15:59.158674215 +0000
@@ -397 +397 @@
- 40
+ @opts[:no_auto_parameterize] ? super : 40
lib/sequel/extensions/schema_caching.rb
--- /tmp/d20241202-3013-95f3hp/sequel-5.86.0/lib/sequel/extensions/schema_caching.rb 2024-12-02 03:15:59.110674196 +0000
+++ /tmp/d20241202-3013-95f3hp/sequel-5.87.0/lib/sequel/extensions/schema_caching.rb 2024-12-02 03:15:59.162674215 +0000
@@ -54,8 +54 @@
- sch = {}
- @schemas.sort.each do |k,v|
- sch[k] = v.map do |c, h|
- h = Hash[h]
- h.delete(:callable_default)
- [c, h]
- end
- end
+ sch = dumpable_schema_cache
@@ -75 +68 @@
- @schemas = Marshal.load(File.read(file))
+ @schemas = load_schema_cache_file(file)
@@ -83,0 +77,22 @@
+ end
+
+ private
+
+ # Return the deserialized schema cache file.
+ def load_schema_cache_file(file)
+ Marshal.load(File.read(file))
+ end
+
+ # A dumpable version of the schema cache.
+ def dumpable_schema_cache
+ sch = {}
+
+ @schemas.sort.each do |k,v|
+ sch[k] = v.map do |c, h|
+ h = Hash[h]
+ h.delete(:callable_default)
+ [c, h]
+ end
+ end
+
+ sch
lib/sequel/extensions/sqlite_json_ops.rb
--- /tmp/d20241202-3013-95f3hp/sequel-5.86.0/lib/sequel/extensions/sqlite_json_ops.rb 2024-12-02 03:15:59.110674196 +0000
+++ /tmp/d20241202-3013-95f3hp/sequel-5.87.0/lib/sequel/extensions/sqlite_json_ops.rb 2024-12-02 03:15:59.186674225 +0000
@@ -38 +38 @@
-# j.get_text(1) # (json_column -> 1)
+# j.get_json(1) # (json_column -> 1)
lib/sequel/model/base.rb
--- /tmp/d20241202-3013-95f3hp/sequel-5.86.0/lib/sequel/model/base.rb 2024-12-02 03:15:59.114674197 +0000
+++ /tmp/d20241202-3013-95f3hp/sequel-5.87.0/lib/sequel/model/base.rb 2024-12-02 03:15:59.190674227 +0000
@@ -90 +90 @@
- # or nil otherwise. This and simple_pk are used for an optimization in Model.[].
+ # or nil otherwise. This and simple_pk are used for an optimization in Model[].
@@ -401 +401 @@
- # You are encouraged to use Model.[] or Model.first instead of this method.
+ # You are encouraged to use Model[] or Model.first instead of this method.
@@ -1314 +1314 @@
- "#<#{model.name} @values=#{inspect_values}>"
+ "#<#{inspect_prefix} @values=#{inspect_values}>"
@@ -1997 +1997,6 @@
- # Default inspection output for the values hash, overwrite to change what #inspect displays.
+ # Default inspect output for the inspect, by default, just showing the class.
+ def inspect_prefix
+ model.name
+ end
+
+ # Default inspect output for the values hash, overwrite to change what #inspect displays.
lib/sequel/version.rb
--- /tmp/d20241202-3013-95f3hp/sequel-5.86.0/lib/sequel/version.rb 2024-12-02 03:15:59.134674205 +0000
+++ /tmp/d20241202-3013-95f3hp/sequel-5.87.0/lib/sequel/version.rb 2024-12-02 03:15:59.210674234 +0000
@@ -9 +9 @@
- MINOR = 86
+ MINOR = 87 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bumps sequel from 5.86.0 to 5.87.0.
Changelog
Sourced from sequel's changelog.
Commits
af0d17a
Bump version to 5.87.0f92c4aa
Add subset_conditions spec for use of exclude with block17afae1
Fix visibility of method in inspect_pk spece962f66
Fix typo in sqlite_json_ops example code6a7f915
Add pg_schema_caching extension, for reloading OIDs for custom types when loa...b0cac98
Update CHANGELOGb59c0aa
MySQL and Postgres schema_parse_table: retrieve comments0bda470
Add inspect_pk plugin to make it easier to retrieve model instance based on i...d20c40d
Treat all Trilogy errors with error code 1205 as Sequel::DatabaseLockTimeout ...c6c9588
Allow Data{base,set}#extension to not require files if the extension is alrea...Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditions
will show all of the ignore conditions of the specified dependency@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)