5.4.0.txt

doc/release_notes/5.4.0.txt
Last Update: 2018-01-04 07:14:17 -0800

New Features

  • An index_caching extension has been added, which makes Database#indexes use a cache similar to Database#schema, and also offers methods for saving and loading the cache from a file, similar to the schema_caching extension.

    This can speed up model loaded in certain cases when the auto_validations plugin is used.

  • A datetime_parse_to_time extension has been added, which parses strings without timezone offsets using DateTime.parse intead of Time.parse. This can fix problems when the string being parsed represents a time not valid in the local timezone due to daylight savings time shifts. Time.parse silently shifts such times by 1 hour instead of raising an exception, resulting in incorrect behavior in that case.

    It only makes sense to use this extension when the times in the database are stored in UTC but not returned with timezone information, the timezone for the Database instance (or Sequel.database_timezone) is set to :utc (not the default), and Time is used as the datetime_class (the default).

  • A pg_timestamptz extension has been added for switching the default generic timestamp type from timestamp to timestamptz.

  • Sequel.date_{add,sub} in the date_arithmetic extension now supports a :cast option for setting the cast type. This value defaults to Time for backwards compatibility, which uses the default generic timestamp type for the database.

  • The class_table_inheritance plugin now supports an :ignore_subclass_columns option which takes an array of column symbols to ignore in subclasses. This allows you to use the plugin when your table inheritance hierarchy includes non-primary key columns with the same name in different tables.

Improvements

  • Dataset#insert_select now returns false instead of nil if it runs an INSERT statement but does not return a value on Microsoft SQL Server or PostgreSQL. This can happen on both databases if triggers are used.

    Model#save now checks for a false value returned by Dataset#insert_select, and does not issue another INSERT statement in that case.

  • Database#indexes now correctly handles SQL::Identifier arguments on SQLite, Microsoft SQL Server, SQLAnywhere, and DB2.

  • Dataset#to_json in the json_serializer plugin and Dataset#to_xml in the xml_serializer plugin now both handle datasets that use eager_graph.

  • Dataset#nullify now caches the dataset it returns, for better performance if it is called more than once on the same dataset.

  • Database#synchronize is now optimized on ruby 2.5+ and is about 10% faster by relying on the new lazy proc allocation feature.

Backwards Compatibility

  • Fractional second timestamps are now enabled on DB2. If you are connecting to a DB2 database that does not support fractional seconds, you should add the following code (where DB is your Sequel::Database instance):

    DB.extend_datasets do
      def supports_timestamp_usecs?
        false
      end
    end
    
  • Calling a filtering method with no argument and a virtual row block that returns nil on a dataset with no existing filter now adds a WHERE NULL filter, to match the behavior if given a nil argument. Previously, a deprecation warning was issued and a dataset with no filter was returned.