5.52.0.txt

doc/release_notes/5.52.0.txt
Last Update: 2021-12-30 13:02:13 -0800

New Features

  • When the sql_comments Database extension is used, Database#with_comments is now added, which can be used for including comments for all queries executed inside a given block. This can be useful if you want to analyze database query logs, and want to group all related queries:

     DB.with_comments(model: Album, action: :all) do
       DB[:albums].all
       # SELECT * FROM albums -- model:Album,action:all
    end
    
  • An sql_comments plugin has been added, which will automatically add SQL comments for all queries generated by model class, instance and dataset methods:

    Album.plugin :sql_comments
    
    album = Album[1]
    # SELECT * FROM albums WHERE (id = 1) LIMIT 1
    # -- model:Album,method_type:class,method:[]
    
    album.update(:name=>'A')
    # UPDATE albums SET name = 'baz' WHERE (id = 1)
    # -- model:Album,method_type:instance,method:update
    
    Album.where(id: 1).delete
    # DELETE FROM albums WHERE (id = 1)
    # -- model:Album,method_type:dataset,method:delete
    

    This plugin requires you have loaded the sql_comments Database extension into the related Database before use.

  • A date_parse_input_handler extension has been added to support custom handling of input to date parsing methods. Among other things, you can use this to limit the length of strings that will be parsed, which can prevent ArgumentErrors in newer Ruby versions:

    Sequel.extension :date_parse_input_handler
    Sequel.date_parse_input_handler do |string|
      string.b[0, 128]
    end
    

Other Improvements

  • On Ruby 3.1, the core_refinements extension now avoids the deprecated Refinement#include, switching to Refinement#import_methods.

  • On Ruby 3.1, the subclasses plugin will use Ruby’s native support for Class#subclasses.

  • The subclasses plugin has renamed descendents to descendants and freeze_descendents to freeze_descendants. The previous method names are still available as aliases.

  • The :ruby_default schema entry for datetime/timestamp columns now respects Sequel.datetime_class. Previously, the value for the :ruby_default schema entry would always be a DateTime value for such columns.

  • The pg_interval extension now works with ActiveSupport 7.0.

  • The shared postgres adapter now respects Database#default_string_column_size for setting the size of string columns that don’t use text as the database type.

  • Database#supports_check_constraints? now returns true on MySQL 8.0.19+. This fixes drop_constraint in certain cases when combining the constraint dropping with other changes in the same alter_table block.

  • The mysql adapter now supports the ruby-mysql 3 API (ruby-mysql is a pure-ruby MySQL driver).

  • The mysql adapter no longer uses the connection’s server_version method if it is defined, as the method does not return the correct value when using the ruby-mysql driver with MariaDB.

  • Comments added by the sql_comments extension no longer modify cached SQL for a dataset.

Other

  • This is Sequel’s 250th release!