Hello community,

here is the log from the commit of package rubygem-activerecord-5_0 for 
openSUSE:Factory checked in at 2018-07-18 22:48:17
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-activerecord-5_0 (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-activerecord-5_0.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-activerecord-5_0"

Wed Jul 18 22:48:17 2018 rev:8 rq:620982 version:5.0.7

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/rubygem-activerecord-5_0/rubygem-activerecord-5_0.changes
        2017-09-26 21:16:16.894714162 +0200
+++ 
/work/SRC/openSUSE:Factory/.rubygem-activerecord-5_0.new/rubygem-activerecord-5_0.changes
   2018-07-18 22:48:19.404078261 +0200
@@ -1,0 +2,73 @@
+Fri Mar 30 04:30:54 UTC 2018 - [email protected]
+
+- updated to version 5.0.7
+ see installed CHANGELOG.md
+
+  ## Rails 5.0.7 (March 29, 2018) ##
+  
+  *   Apply time column precision on assignment.
+  
+      PR #20317 changed the behavior of datetime columns so that when they
+      have a specified precision then on assignment the value is rounded to
+      that precision. This behavior is now applied to time columns as well.
+  
+      Fixes #30301.
+  
+      *Andrew White*
+  
+  *   Normalize time column values for SQLite database.
+  
+      For legacy reasons, time columns in SQLite are stored as full datetimes
+      because until #24542 the quoting for time columns didn't remove the date
+      component. To ensure that values are consistent we now normalize the
+      date component to 2001-01-01 on reading and writing.
+  
+      *Andrew White*
+  
+  *   Ensure that the date component is removed when quoting times.
+  
+      PR #24542 altered the quoting for time columns so that the date component
+      was removed however it only removed it when it was 2001-01-01. Now the
+      date component is removed irrespective of what the date is.
+  
+      *Andrew White*
+  
+  *   Query cache was unavailable when entering the `ActiveRecord::Base.cache` 
block
+      without being connected.
+  
+      *Tsukasa Oishi*
+  
+  *   Fix `bin/rails db:setup` and `bin/rails db:test:prepare` create  wrong
+      ar_internal_metadata's data for a test database.
+  
+      Before:
+      ```
+      $ RAILS_ENV=test rails dbconsole
+      > SELECT * FROM ar_internal_metadata;
+      key|value|created_at|updated_at
+      environment|development|2017-09-11 23:14:10.815679|2017-09-11 
23:14:10.815679
+      ```
+  
+      After:
+      ```
+      $ RAILS_ENV=test rails dbconsole
+      > SELECT * FROM ar_internal_metadata;
+      key|value|created_at|updated_at
+      environment|test|2017-09-11 23:14:10.815679|2017-09-11 23:14:10.815679
+      ```
+  
+      Fixes #26731.
+  
+      *bogdanvlviv*
+  
+  *   Fix longer sequence name detection for serial columns.
+  
+      Fixes #28332.
+  
+      *Ryuta Kamizono*
+  
+  *   Use `max_identifier_length` for `index_name_length` in PostgreSQL 
adapter.
+  
+      *Ryuta Kamizono*
+
+-------------------------------------------------------------------

Old:
----
  activerecord-5.0.6.gem

New:
----
  activerecord-5.0.7.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-activerecord-5_0.spec ++++++
--- /var/tmp/diff_new_pack.bjm8Ve/_old  2018-07-18 22:48:19.828076856 +0200
+++ /var/tmp/diff_new_pack.bjm8Ve/_new  2018-07-18 22:48:19.828076856 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package rubygem-activerecord-5_0
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-activerecord-5_0
-Version:        5.0.6
+Version:        5.0.7
 Release:        0
 %define mod_name activerecord
 %define mod_full_name %{mod_name}-%{version}

++++++ activerecord-5.0.6.gem -> activerecord-5.0.7.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md    2017-09-08 02:44:52.000000000 +0200
+++ new/CHANGELOG.md    2018-03-29 19:57:28.000000000 +0200
@@ -1,3 +1,71 @@
+## Rails 5.0.7 (March 29, 2018) ##
+
+*   Apply time column precision on assignment.
+
+    PR #20317 changed the behavior of datetime columns so that when they
+    have a specified precision then on assignment the value is rounded to
+    that precision. This behavior is now applied to time columns as well.
+
+    Fixes #30301.
+
+    *Andrew White*
+
+*   Normalize time column values for SQLite database.
+
+    For legacy reasons, time columns in SQLite are stored as full datetimes
+    because until #24542 the quoting for time columns didn't remove the date
+    component. To ensure that values are consistent we now normalize the
+    date component to 2001-01-01 on reading and writing.
+
+    *Andrew White*
+
+*   Ensure that the date component is removed when quoting times.
+
+    PR #24542 altered the quoting for time columns so that the date component
+    was removed however it only removed it when it was 2001-01-01. Now the
+    date component is removed irrespective of what the date is.
+
+    *Andrew White*
+
+*   Query cache was unavailable when entering the `ActiveRecord::Base.cache` 
block
+    without being connected.
+
+    *Tsukasa Oishi*
+
+*   Fix `bin/rails db:setup` and `bin/rails db:test:prepare` create  wrong
+    ar_internal_metadata's data for a test database.
+
+    Before:
+    ```
+    $ RAILS_ENV=test rails dbconsole
+    > SELECT * FROM ar_internal_metadata;
+    key|value|created_at|updated_at
+    environment|development|2017-09-11 23:14:10.815679|2017-09-11 
23:14:10.815679
+    ```
+
+    After:
+    ```
+    $ RAILS_ENV=test rails dbconsole
+    > SELECT * FROM ar_internal_metadata;
+    key|value|created_at|updated_at
+    environment|test|2017-09-11 23:14:10.815679|2017-09-11 23:14:10.815679
+    ```
+
+    Fixes #26731.
+
+    *bogdanvlviv*
+
+*   Fix longer sequence name detection for serial columns.
+
+    Fixes #28332.
+
+    *Ryuta Kamizono*
+
+*   Use `max_identifier_length` for `index_name_length` in PostgreSQL adapter.
+
+    *Ryuta Kamizono*
+
+
 ## Rails 5.0.6 (September 07, 2017) ##
 
 *   No changes.
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/associations/join_dependency/join_association.rb 
new/lib/active_record/associations/join_dependency/join_association.rb
--- old/lib/active_record/associations/join_dependency/join_association.rb      
2017-09-08 02:44:52.000000000 +0200
+++ new/lib/active_record/associations/join_dependency/join_association.rb      
2018-03-29 19:57:29.000000000 +0200
@@ -63,11 +63,8 @@
               else
                 klass.send(:build_default_scope, relation)
               end
-            scope_chain_items.concat [klass_scope].compact
 
-            rel = scope_chain_items.inject(scope_chain_items.shift) do |left, 
right|
-              left.merge right
-            end
+            rel = scope_chain_items.inject(klass_scope || 
scope_chain_items.shift, &:merge!)
 
             if rel && !rel.arel.constraints.empty?
               binds += rel.bound_attributes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/associations/preloader/association.rb 
new/lib/active_record/associations/preloader/association.rb
--- old/lib/active_record/associations/preloader/association.rb 2017-09-08 
02:44:52.000000000 +0200
+++ new/lib/active_record/associations/preloader/association.rb 2018-03-29 
19:57:29.000000000 +0200
@@ -131,42 +131,15 @@
         end
 
         def build_scope
-          scope = klass.unscoped
+          scope = klass.scope_for_association
 
-          values = reflection_scope.values
-          preload_values = preload_scope.values
-
-          scope.where_clause = reflection_scope.where_clause + 
preload_scope.where_clause
-          scope.references_values = Array(values[:references]) + 
Array(preload_values[:references])
-
-          if preload_values[:select] || values[:select]
-            scope._select!(preload_values[:select] || values[:select])
-          end
-          scope.includes! preload_values[:includes] || values[:includes]
-          if preload_scope.joins_values.any?
-            scope.joins!(preload_scope.joins_values)
-          else
-            scope.joins!(reflection_scope.joins_values)
-          end
-
-          if order_values = preload_values[:order] || values[:order]
-            scope.order!(order_values)
-          end
-
-          if preload_values[:reordering] || values[:reordering]
-            scope.reordering_value = true
-          end
-
-          if preload_values[:readonly] || values[:readonly]
-            scope.readonly!
-          end
-
-          if options[:as]
-            scope.where!(klass.table_name => { reflection.type => 
model.base_class.sti_name })
+          if reflection.type
+            scope.where!(reflection.type => model.base_class.sti_name)
           end
 
-          scope.unscope_values = Array(values[:unscope]) + 
Array(preload_values[:unscope])
-          klass.scope_for_association.merge(scope)
+          scope.merge!(reflection_scope)
+          scope.merge!(preload_scope) if preload_scope != NULL_RELATION
+          scope
         end
       end
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/associations/preloader/through_association.rb 
new/lib/active_record/associations/preloader/through_association.rb
--- old/lib/active_record/associations/preloader/through_association.rb 
2017-09-08 02:44:52.000000000 +0200
+++ new/lib/active_record/associations/preloader/through_association.rb 
2018-03-29 19:57:29.000000000 +0200
@@ -79,20 +79,26 @@
           end
         end
 
-
         def through_scope
           scope = through_reflection.klass.unscoped
+          values = reflection_scope.values
 
           if options[:source_type]
             scope.where! reflection.foreign_type => options[:source_type]
           else
             unless reflection_scope.where_clause.empty?
-              scope.includes_values = Array(reflection_scope.values[:includes] 
|| options[:source])
+              scope.includes_values = Array(values[:includes] || 
options[:source])
               scope.where_clause = reflection_scope.where_clause
+              if joins = values[:joins]
+                scope.joins!(source_reflection.name => joins)
+              end
+              if left_outer_joins = values[:left_outer_joins]
+                scope.left_outer_joins!(source_reflection.name => 
left_outer_joins)
+              end
             end
 
-            scope.references! reflection_scope.values[:references]
-            if scope.eager_loading? && order_values = 
reflection_scope.values[:order]
+            scope.references! values[:references]
+            if scope.eager_loading? && order_values = values[:order]
               scope = scope.order(order_values)
             end
           end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/attribute_methods/time_zone_conversion.rb 
new/lib/active_record/attribute_methods/time_zone_conversion.rb
--- old/lib/active_record/attribute_methods/time_zone_conversion.rb     
2017-09-08 02:44:52.000000000 +0200
+++ new/lib/active_record/attribute_methods/time_zone_conversion.rb     
2018-03-29 19:57:29.000000000 +0200
@@ -102,7 +102,7 @@
 
                   config.active_record.time_zone_aware_types = [:datetime]
 
-              To silence this deprecation warning, add the following:
+              To use the new behavior, add the following:
 
                   config.active_record.time_zone_aware_types = [:datetime, 
:time]
             MESSAGE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/attribute_set/builder.rb 
new/lib/active_record/attribute_set/builder.rb
--- old/lib/active_record/attribute_set/builder.rb      2017-09-08 
02:44:52.000000000 +0200
+++ new/lib/active_record/attribute_set/builder.rb      2018-03-29 
19:57:29.000000000 +0200
@@ -3,35 +3,30 @@
 module ActiveRecord
   class AttributeSet # :nodoc:
     class Builder # :nodoc:
-      attr_reader :types, :always_initialized, :default
+      attr_reader :types, :default_attributes
 
-      def initialize(types, always_initialized = nil, &default)
+      def initialize(types, default_attributes = {})
         @types = types
-        @always_initialized = always_initialized
-        @default = default
+        @default_attributes = default_attributes
       end
 
       def build_from_database(values = {}, additional_types = {})
-        if always_initialized && !values.key?(always_initialized)
-          values[always_initialized] = nil
-        end
-
-        attributes = LazyAttributeHash.new(types, values, additional_types, 
&default)
+        attributes = LazyAttributeHash.new(types, values, additional_types, 
default_attributes)
         AttributeSet.new(attributes)
       end
     end
   end
 
   class LazyAttributeHash # :nodoc:
-    delegate :transform_values, :each_key, :fetch, to: :materialize
+    delegate :transform_values, :each_key, :fetch, :except, to: :materialize
 
-    def initialize(types, values, additional_types, &default)
+    def initialize(types, values, additional_types, default_attributes, 
delegate_hash = {})
       @types = types
       @values = values
       @additional_types = additional_types
       @materialized = false
-      @delegate_hash = {}
-      @default = default || proc {}
+      @delegate_hash = delegate_hash
+      @default_attributes = default_attributes
     end
 
     def key?(key)
@@ -79,15 +74,17 @@
     end
 
     def marshal_dump
-      materialize
+      [@types, @values, @additional_types, @default_attributes, @delegate_hash]
     end
 
-    def marshal_load(delegate_hash)
-      @delegate_hash = delegate_hash
-      @types = {}
-      @values = {}
-      @additional_types = {}
-      @materialized = true
+    def marshal_load(values)
+      if values.is_a?(Hash)
+        empty_hash = {}.freeze
+        initialize(empty_hash, empty_hash, empty_hash, empty_hash, values)
+        @materialized = true
+      else
+        initialize(*values)
+      end
     end
 
     def encode_with(coder)
@@ -100,7 +97,7 @@
 
     protected
 
-    attr_reader :types, :values, :additional_types, :delegate_hash, :default
+    attr_reader :types, :values, :additional_types, :delegate_hash, 
:default_attributes
 
     def materialize
       unless @materialized
@@ -123,7 +120,12 @@
       if value_present
         delegate_hash[name] = Attribute.from_database(name, value, type)
       elsif types.key?(name)
-        delegate_hash[name] = default.call(name) || 
Attribute.uninitialized(name, type)
+        attr = default_attributes[name]
+        if attr
+          delegate_hash[name] = attr.dup
+        else
+          delegate_hash[name] = Attribute.uninitialized(name, type)
+        end
       end
     end
   end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/attribute_set.rb 
new/lib/active_record/attribute_set.rb
--- old/lib/active_record/attribute_set.rb      2017-09-08 02:44:52.000000000 
+0200
+++ new/lib/active_record/attribute_set.rb      2018-03-29 19:57:29.000000000 
+0200
@@ -2,7 +2,7 @@
 
 module ActiveRecord
   class AttributeSet # :nodoc:
-    delegate :fetch, to: :attributes
+    delegate :fetch, :except, to: :attributes
 
     def initialize(attributes)
       @attributes = attributes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/connection_adapters/abstract/query_cache.rb 
new/lib/active_record/connection_adapters/abstract/query_cache.rb
--- old/lib/active_record/connection_adapters/abstract/query_cache.rb   
2017-09-08 02:44:52.000000000 +0200
+++ new/lib/active_record/connection_adapters/abstract/query_cache.rb   
2018-03-29 19:57:29.000000000 +0200
@@ -101,8 +101,14 @@
       def cache_sql(sql, binds)
         result =
           if @query_cache[sql].key?(binds)
-            ActiveSupport::Notifications.instrument("sql.active_record",
-              :sql => sql, :binds => binds, :name => "CACHE", :connection_id 
=> object_id)
+            ActiveSupport::Notifications.instrument(
+              "sql.active_record",
+              sql: sql,
+              binds: binds,
+              type_casted_binds: -> { type_casted_binds(binds) },
+              name: "CACHE",
+              connection_id: object_id,
+            )
             @query_cache[sql][binds]
           else
             @query_cache[sql][binds] = yield
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/connection_adapters/abstract/quoting.rb 
new/lib/active_record/connection_adapters/abstract/quoting.rb
--- old/lib/active_record/connection_adapters/abstract/quoting.rb       
2017-09-08 02:44:52.000000000 +0200
+++ new/lib/active_record/connection_adapters/abstract/quoting.rb       
2018-03-29 19:57:29.000000000 +0200
@@ -148,7 +148,7 @@
       end
 
       def quoted_time(value) # :nodoc:
-        quoted_date(value).sub(/\A2000-01-01 /, '')
+        quoted_date(value).sub(/\A\d\d\d\d-\d\d-\d\d /, '')
       end
 
       def prepare_binds_for_database(binds) # :nodoc:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/connection_adapters/abstract_mysql_adapter.rb 
new/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
--- old/lib/active_record/connection_adapters/abstract_mysql_adapter.rb 
2017-09-08 02:44:52.000000000 +0200
+++ new/lib/active_record/connection_adapters/abstract_mysql_adapter.rb 
2018-03-29 19:57:29.000000000 +0200
@@ -68,7 +68,7 @@
         @statements = 
StatementPool.new(self.class.type_cast_config_to_integer(config[:statement_limit]))
 
         if version < '5.0.0'
-          raise "Your version of MySQL 
(#{full_version.match(/^\d+\.\d+\.\d+/)[0]}) is too old. Active Record supports 
MySQL >= 5.0."
+          raise "Your version of MySQL (#{version_string}) is too old. Active 
Record supports MySQL >= 5.0."
         end
       end
 
@@ -81,7 +81,7 @@
       end
 
       def version #:nodoc:
-        @version ||= Version.new(full_version.match(/^\d+\.\d+\.\d+/)[0])
+        @version ||= Version.new(version_string)
       end
 
       def mariadb? # :nodoc:
@@ -399,8 +399,8 @@
         table_name = table_name.to_s
         column_definitions(table_name).map do |field|
           type_metadata = fetch_type_metadata(field[:Type], field[:Extra])
-          if type_metadata.type == :datetime && field[:Default] == 
"CURRENT_TIMESTAMP"
-            default, default_function = nil, field[:Default]
+          if type_metadata.type == :datetime && field[:Default] =~ 
/\ACURRENT_TIMESTAMP(?:\(\))?\z/i
+            default, default_function = nil, "CURRENT_TIMESTAMP"
           else
             default, default_function = field[:Default], nil
           end
@@ -940,6 +940,10 @@
         end
       end
 
+      def version_string
+        full_version.match(/^(?:5\.5\.5-)?(\d+\.\d+\.\d+)/)[1]
+      end
+
       class MysqlJson < Type::Internal::AbstractJson # :nodoc:
         def changed_in_place?(raw_old_value, new_value)
           # Normalization is required because MySQL JSON data format includes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/connection_adapters/column.rb 
new/lib/active_record/connection_adapters/column.rb
--- old/lib/active_record/connection_adapters/column.rb 2017-09-08 
02:44:52.000000000 +0200
+++ new/lib/active_record/connection_adapters/column.rb 2018-03-29 
19:57:29.000000000 +0200
@@ -13,7 +13,7 @@
       # +default+ is the type-casted default value, such as +new+ in 
<tt>sales_stage varchar(20) default 'new'</tt>.
       # +sql_type_metadata+ is various information about the type of the column
       # +null+ determines if this column allows +NULL+ values.
-      def initialize(name, default, sql_type_metadata = nil, null = true, 
table_name = nil, default_function = nil, collation = nil, comment: nil)
+      def initialize(name, default, sql_type_metadata = nil, null = true, 
table_name = nil, default_function = nil, collation = nil, comment: nil, **)
         @name = name.freeze
         @table_name = table_name
         @sql_type_metadata = sql_type_metadata
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/connection_adapters/mysql2_adapter.rb 
new/lib/active_record/connection_adapters/mysql2_adapter.rb
--- old/lib/active_record/connection_adapters/mysql2_adapter.rb 2017-09-08 
02:44:52.000000000 +0200
+++ new/lib/active_record/connection_adapters/mysql2_adapter.rb 2018-03-29 
19:57:29.000000000 +0200
@@ -1,7 +1,7 @@
 require 'active_record/connection_adapters/abstract_mysql_adapter'
 require 'active_record/connection_adapters/mysql/database_statements'
 
-gem 'mysql2', '>= 0.3.18', '< 0.5'
+gem 'mysql2', '>= 0.3.18', '< 0.6.0'
 require 'mysql2'
 raise 'mysql2 0.4.3 is not supported. Please upgrade to 0.4.4+' if 
Mysql2::VERSION == '0.4.3'
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/connection_adapters/postgresql/column.rb 
new/lib/active_record/connection_adapters/postgresql/column.rb
--- old/lib/active_record/connection_adapters/postgresql/column.rb      
2017-09-08 02:44:52.000000000 +0200
+++ new/lib/active_record/connection_adapters/postgresql/column.rb      
2018-03-29 19:57:29.000000000 +0200
@@ -5,11 +5,38 @@
       delegate :array, :oid, :fmod, to: :sql_type_metadata
       alias :array? :array
 
+      def initialize(*, max_identifier_length: 63, **)
+        super
+        @max_identifier_length = max_identifier_length
+      end
+
       def serial?
         return unless default_function
 
-        %r{\Anextval\('"?#{table_name}_#{name}_seq"?'::regclass\)\z} === 
default_function
+        if 
%r{\Anextval\('"?(?<sequence_name>.+_(?<suffix>seq\d*))"?'::regclass\)\z} =~ 
default_function
+          sequence_name_from_parts(table_name, name, suffix) == sequence_name
+        end
       end
+
+      protected
+        attr_reader :max_identifier_length
+
+      private
+        def sequence_name_from_parts(table_name, column_name, suffix)
+          over_length = [table_name, column_name, suffix].map(&:length).sum + 
2 - max_identifier_length
+
+          if over_length > 0
+            column_name_length = [(max_identifier_length - suffix.length - 2) 
/ 2, column_name.length].min
+            over_length -= column_name.length - column_name_length
+            column_name = column_name[0, column_name_length - [over_length, 
0].min]
+          end
+
+          if over_length > 0
+            table_name = table_name[0, table_name.length - over_length]
+          end
+
+          "#{table_name}_#{column_name}_#{suffix}"
+        end
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/connection_adapters/postgresql/schema_statements.rb 
new/lib/active_record/connection_adapters/postgresql/schema_statements.rb
--- old/lib/active_record/connection_adapters/postgresql/schema_statements.rb   
2017-09-08 02:44:52.000000000 +0200
+++ new/lib/active_record/connection_adapters/postgresql/schema_statements.rb   
2018-03-29 19:57:29.000000000 +0200
@@ -230,7 +230,7 @@
             type_metadata = fetch_type_metadata(column_name, type, oid, fmod)
             default_value = extract_value_from_default(default)
             default_function = extract_default_function(default_value, default)
-            new_column(column_name, default_value, type_metadata, !notnull, 
table_name, default_function, collation, comment: comment.presence)
+            new_column(column_name, default_value, type_metadata, !notnull, 
table_name, default_function, collation, comment: comment.presence, 
max_identifier_length: max_identifier_length)
           end
         end
 
@@ -629,10 +629,6 @@
           end
         end
 
-        def index_name_length
-          63
-        end
-
         # Maps logical Rails types to PostgreSQL-specific data types.
         def type_to_sql(type, limit = nil, precision = nil, scale = nil, array 
= nil)
           sql = case type.to_s
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/connection_adapters/postgresql_adapter.rb 
new/lib/active_record/connection_adapters/postgresql_adapter.rb
--- old/lib/active_record/connection_adapters/postgresql_adapter.rb     
2017-09-08 02:44:52.000000000 +0200
+++ new/lib/active_record/connection_adapters/postgresql_adapter.rb     
2018-03-29 19:57:29.000000000 +0200
@@ -1,5 +1,5 @@
 # Make sure we're using pg high enough for type casts and Ruby 2.2+ 
compatibility
-gem 'pg', '~> 0.18'
+gem "pg", ">= 0.18", "< 2.0"
 require 'pg'
 
 require "active_record/connection_adapters/abstract_adapter"
@@ -212,7 +212,7 @@
 
         # @local_tz is initialized as nil to avoid warnings when connect tries 
to use it
         @local_tz = nil
-        @table_alias_length = nil
+        @max_identifier_length = nil
 
         connect
         add_pg_encoders
@@ -358,9 +358,11 @@
       end
 
       # Returns the configured supported identifier length supported by 
PostgreSQL
-      def table_alias_length
-        @table_alias_length ||= query('SHOW max_identifier_length', 
'SCHEMA')[0][0].to_i
+      def max_identifier_length
+        @max_identifier_length ||= query('SHOW max_identifier_length', 
'SCHEMA')[0][0].to_i
       end
+      alias table_alias_length max_identifier_length
+      alias index_name_length max_identifier_length
 
       # Set the authorized user for this session
       def session_auth=(user)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/active_record/connection_adapters/sqlite3/quoting.rb 
new/lib/active_record/connection_adapters/sqlite3/quoting.rb
--- old/lib/active_record/connection_adapters/sqlite3/quoting.rb        
2017-09-08 02:44:52.000000000 +0200
+++ new/lib/active_record/connection_adapters/sqlite3/quoting.rb        
2018-03-29 19:57:29.000000000 +0200
@@ -15,7 +15,7 @@
         end
 
         def quoted_time(value)
-          quoted_date(value)
+          quoted_date(value).sub(/\A\d\d\d\d-\d\d-\d\d /, "2000-01-01 ")
         end
 
         private
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/gem_version.rb 
new/lib/active_record/gem_version.rb
--- old/lib/active_record/gem_version.rb        2017-09-08 02:44:52.000000000 
+0200
+++ new/lib/active_record/gem_version.rb        2018-03-29 19:57:29.000000000 
+0200
@@ -7,7 +7,7 @@
   module VERSION
     MAJOR = 5
     MINOR = 0
-    TINY  = 6
+    TINY  = 7
     PRE   = nil
 
     STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/log_subscriber.rb 
new/lib/active_record/log_subscriber.rb
--- old/lib/active_record/log_subscriber.rb     2017-09-08 02:44:52.000000000 
+0200
+++ new/lib/active_record/log_subscriber.rb     2018-03-29 19:57:29.000000000 
+0200
@@ -33,7 +33,7 @@
       binds = nil
 
       unless (payload[:binds] || []).empty?
-        casted_params = type_casted_binds(payload[:binds], 
payload[:type_casted_binds])
+        casted_params = type_casted_binds(payload[:type_casted_binds])
         binds = "  " + payload[:binds].zip(casted_params).map { |attr, value|
           render_bind(attr, value)
         }.inspect
@@ -47,8 +47,8 @@
 
     private
 
-    def type_casted_binds(binds, casted_binds)
-      casted_binds || ActiveRecord::Base.connection.type_casted_binds(binds)
+    def type_casted_binds(casted_binds)
+      casted_binds.respond_to?(:call) ? casted_binds.call : casted_binds
     end
 
     def render_bind(attr, value)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/model_schema.rb 
new/lib/active_record/model_schema.rb
--- old/lib/active_record/model_schema.rb       2017-09-08 02:44:52.000000000 
+0200
+++ new/lib/active_record/model_schema.rb       2018-03-29 19:57:29.000000000 
+0200
@@ -113,20 +113,6 @@
     # If true, the default table name for a Product class will be "products". 
If false, it would just be "product".
     # See table_name for the full rules on table/class naming. This is true, 
by default.
 
-    ##
-    # :singleton-method: ignored_columns
-    # :call-seq: ignored_columns
-    #
-    # The list of columns names the model should ignore. Ignored columns won't 
have attribute
-    # accessors defined, and won't be referenced in SQL queries.
-
-    ##
-    # :singleton-method: ignored_columns=
-    # :call-seq: ignored_columns=(columns)
-    #
-    # Sets the columns names the model should ignore. Ignored columns won't 
have attribute
-    # accessors defined, and won't be referenced in SQL queries.
-
     included do
       mattr_accessor :primary_key_prefix_type, instance_writer: false
 
@@ -148,10 +134,8 @@
       class_attribute :pluralize_table_names, instance_writer: false
       self.pluralize_table_names = true
 
-      class_attribute :ignored_columns, instance_accessor: false
-      self.ignored_columns = [].freeze
-
       self.inheritance_column = 'type'
+      self.ignored_columns = [].freeze
 
       delegate :type_for_attribute, to: :class
 
@@ -282,6 +266,22 @@
         @explicit_inheritance_column = true
       end
 
+      # The list of columns names the model should ignore. Ignored columns 
won't have attribute
+      # accessors defined, and won't be referenced in SQL queries.
+      def ignored_columns
+        if defined?(@ignored_columns)
+          @ignored_columns
+        else
+          superclass.ignored_columns
+        end
+      end
+
+      # Sets the columns names the model should ignore. Ignored columns won't 
have attribute
+      # accessors defined, and won't be referenced in SQL queries.
+      def ignored_columns=(columns)
+        @ignored_columns = columns.map(&:to_s)
+      end
+
       def sequence_name
         if base_class == self
           @sequence_name ||= reset_sequence_name
@@ -332,11 +332,11 @@
       end
 
       def attributes_builder # :nodoc:
-        @attributes_builder ||= AttributeSet::Builder.new(attribute_types, 
primary_key) do |name|
-          unless columns_hash.key?(name)
-            _default_attributes[name].dup
-          end
+        unless defined?(@attributes_builder) && @attributes_builder
+          defaults = _default_attributes.except(*(column_names - 
[primary_key]))
+          @attributes_builder = AttributeSet::Builder.new(attribute_types, 
defaults)
         end
+        @attributes_builder
       end
 
       def columns_hash # :nodoc:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/query_cache.rb 
new/lib/active_record/query_cache.rb
--- old/lib/active_record/query_cache.rb        2017-09-08 02:44:52.000000000 
+0200
+++ new/lib/active_record/query_cache.rb        2018-03-29 19:57:29.000000000 
+0200
@@ -5,7 +5,7 @@
       # Enable the query cache within the block if Active Record is configured.
       # If it's not, it will execute the given block.
       def cache(&block)
-        if connected?
+        if connected? || !configurations.empty?
           connection.cache(&block)
         else
           yield
@@ -15,7 +15,7 @@
       # Disable the query cache within the block if Active Record is 
configured.
       # If it's not, it will execute the given block.
       def uncached(&block)
-        if connected?
+        if connected? || !configurations.empty?
           connection.uncached(&block)
         else
           yield
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/railties/databases.rake 
new/lib/active_record/railties/databases.rake
--- old/lib/active_record/railties/databases.rake       2017-09-08 
02:44:52.000000000 +0200
+++ new/lib/active_record/railties/databases.rake       2018-03-29 
19:57:29.000000000 +0200
@@ -323,7 +323,7 @@
       begin
         should_reconnect = 
ActiveRecord::Base.connection_pool.active_connection?
         ActiveRecord::Schema.verbose = false
-        ActiveRecord::Tasks::DatabaseTasks.load_schema 
ActiveRecord::Base.configurations['test'], :ruby, ENV['SCHEMA']
+        ActiveRecord::Tasks::DatabaseTasks.load_schema 
ActiveRecord::Base.configurations["test"], :ruby, ENV["SCHEMA"], "test"
       ensure
         if should_reconnect
           
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[ActiveRecord::Tasks::DatabaseTasks.env])
@@ -333,7 +333,7 @@
 
     # desc "Recreate the test database from an existent structure.sql file"
     task :load_structure => %w(db:test:purge) do
-      ActiveRecord::Tasks::DatabaseTasks.load_schema 
ActiveRecord::Base.configurations['test'], :sql, ENV['SCHEMA']
+      ActiveRecord::Tasks::DatabaseTasks.load_schema 
ActiveRecord::Base.configurations["test"], :sql, ENV["SCHEMA"], "test"
     end
 
     # desc "Recreate the test database from a fresh schema"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/table_metadata.rb 
new/lib/active_record/table_metadata.rb
--- old/lib/active_record/table_metadata.rb     2017-09-08 02:44:52.000000000 
+0200
+++ new/lib/active_record/table_metadata.rb     2018-03-29 19:57:29.000000000 
+0200
@@ -42,7 +42,7 @@
     end
 
     def associated_table(table_name)
-      association = klass._reflect_on_association(table_name) || 
klass._reflect_on_association(table_name.singularize)
+      association = klass._reflect_on_association(table_name) || 
klass._reflect_on_association(table_name.to_s.singularize)
 
       if !association && table_name == arel_table.name
         return self
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/active_record/tasks/database_tasks.rb 
new/lib/active_record/tasks/database_tasks.rb
--- old/lib/active_record/tasks/database_tasks.rb       2017-09-08 
02:44:52.000000000 +0200
+++ new/lib/active_record/tasks/database_tasks.rb       2018-03-29 
19:57:29.000000000 +0200
@@ -215,22 +215,22 @@
         
class_for_adapter(configuration['adapter']).new(*arguments).structure_load(filename)
       end
 
-      def load_schema(configuration, format = 
ActiveRecord::Base.schema_format, file = nil) # :nodoc:
+      def load_schema(configuration, format = 
ActiveRecord::Base.schema_format, file = nil, environment = env) # :nodoc:
         file ||= schema_file(format)
 
+        check_schema_file(file)
+        ActiveRecord::Base.establish_connection(configuration)
+
         case format
         when :ruby
-          check_schema_file(file)
-          ActiveRecord::Base.establish_connection(configuration)
           load(file)
         when :sql
-          check_schema_file(file)
           structure_load(configuration, file)
         else
           raise ArgumentError, "unknown format #{format.inspect}"
         end
         ActiveRecord::InternalMetadata.create_table
-        ActiveRecord::InternalMetadata[:environment] = 
ActiveRecord::Migrator.current_environment
+        ActiveRecord::InternalMetadata[:environment] = environment
       end
 
       def load_schema_for(*args)
@@ -251,8 +251,8 @@
       end
 
       def load_schema_current(format = ActiveRecord::Base.schema_format, file 
= nil, environment = env)
-        each_current_configuration(environment) { |configuration|
-          load_schema configuration, format, file
+        each_current_configuration(environment) { |configuration, 
configuration_environment|
+          load_schema configuration, format, file, configuration_environment
         }
         ActiveRecord::Base.establish_connection(environment.to_sym)
       end
@@ -289,9 +289,10 @@
         environments = [environment]
         environments << 'test' if environment == 'development'
 
-        configurations = 
ActiveRecord::Base.configurations.values_at(*environments)
-        configurations.compact.each do |configuration|
-          yield configuration unless configuration['database'].blank?
+        ActiveRecord::Base.configurations.slice(*environments).each do 
|configuration_environment, configuration|
+          next unless configuration["database"]
+
+          yield configuration, configuration_environment
         end
       end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2017-09-08 02:44:52.000000000 +0200
+++ new/metadata        2018-03-29 19:57:28.000000000 +0200
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: activerecord
 version: !ruby/object:Gem::Version
-  version: 5.0.6
+  version: 5.0.7
 platform: ruby
 authors:
 - David Heinemeier Hansson
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2017-09-08 00:00:00.000000000 Z
+date: 2018-03-29 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: activesupport
@@ -16,28 +16,28 @@
     requirements:
     - - '='
       - !ruby/object:Gem::Version
-        version: 5.0.6
+        version: 5.0.7
   type: :runtime
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
     - - '='
       - !ruby/object:Gem::Version
-        version: 5.0.6
+        version: 5.0.7
 - !ruby/object:Gem::Dependency
   name: activemodel
   requirement: !ruby/object:Gem::Requirement
     requirements:
     - - '='
       - !ruby/object:Gem::Version
-        version: 5.0.6
+        version: 5.0.7
   type: :runtime
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
     - - '='
       - !ruby/object:Gem::Version
-        version: 5.0.6
+        version: 5.0.7
 - !ruby/object:Gem::Dependency
   name: arel
   requirement: !ruby/object:Gem::Requirement
@@ -328,7 +328,7 @@
       version: '0'
 requirements: []
 rubyforge_project: 
-rubygems_version: 2.6.13
+rubygems_version: 2.6.14
 signing_key: 
 specification_version: 4
 summary: Object-relational mapper framework (part of Rails).


Reply via email to