Hello community, here is the log from the commit of package rubygem-activerecord-4_2 for openSUSE:Factory checked in at 2016-03-18 21:40:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-activerecord-4_2 (Old) and /work/SRC/openSUSE:Factory/.rubygem-activerecord-4_2.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-activerecord-4_2" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-activerecord-4_2/rubygem-activerecord-4_2.changes 2016-03-07 13:28:18.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-activerecord-4_2.new/rubygem-activerecord-4_2.changes 2016-03-18 21:40:36.000000000 +0100 @@ -1,0 +2,36 @@ +Tue Mar 8 05:31:37 UTC 2016 - co...@suse.com + +- updated to version 4.2.6 + see installed CHANGELOG.md + + ## Rails 4.2.6 (March 07, 2016) ## + + * Fix a bug where using `t.foreign_key` twice with the same `to_table` within + the same table definition would only create one foreign key. + + *George Millo* + + * Fix regression in dirty attribute tracking after #dup. Changes to the + clone no longer show as changed attributes in the original object. + + *Dominic Cleal* + + * Fix regression when loading fixture files with symbol keys. + + Closes #22584. + + *Yves Senn* + + * Fix `rake db:structure:dump` on Postgres when multiple schemas are used. + + Fixes #22346. + + *Nick Muerdter*, *ckoenig* + + * Introduce `connection.data_sources` and `connection.data_source_exists?`. + These methods determine what relations can be used to back Active Record + models (usually tables and views). + + *Yves Senn*, *Matthew Draper* + +------------------------------------------------------------------- Old: ---- activerecord-4.2.5.2.gem New: ---- activerecord-4.2.6.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-activerecord-4_2.spec ++++++ --- /var/tmp/diff_new_pack.EQmD6C/_old 2016-03-18 21:40:37.000000000 +0100 +++ /var/tmp/diff_new_pack.EQmD6C/_new 2016-03-18 21:40:37.000000000 +0100 @@ -24,7 +24,7 @@ # Name: rubygem-activerecord-4_2 -Version: 4.2.5.2 +Version: 4.2.6 Release: 0 %define mod_name activerecord %define mod_full_name %{mod_name}-%{version} ++++++ activerecord-4.2.5.2.gem -> activerecord-4.2.6.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md --- old/CHANGELOG.md 2016-02-29 20:16:01.000000000 +0100 +++ new/CHANGELOG.md 2016-03-07 23:31:30.000000000 +0100 @@ -1,3 +1,34 @@ +## Rails 4.2.6 (March 07, 2016) ## + +* Fix a bug where using `t.foreign_key` twice with the same `to_table` within + the same table definition would only create one foreign key. + + *George Millo* + +* Fix regression in dirty attribute tracking after #dup. Changes to the + clone no longer show as changed attributes in the original object. + + *Dominic Cleal* + +* Fix regression when loading fixture files with symbol keys. + + Closes #22584. + + *Yves Senn* + +* Fix `rake db:structure:dump` on Postgres when multiple schemas are used. + + Fixes #22346. + + *Nick Muerdter*, *ckoenig* + +* Introduce `connection.data_sources` and `connection.data_source_exists?`. + These methods determine what relations can be used to back Active Record + models (usually tables and views). + + *Yves Senn*, *Matthew Draper* + + ## Rails 4.2.5.2 (February 26, 2016) ## * No changes. 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/has_many_through_association.rb new/lib/active_record/associations/has_many_through_association.rb --- old/lib/active_record/associations/has_many_through_association.rb 2016-02-29 20:16:01.000000000 +0100 +++ new/lib/active_record/associations/has_many_through_association.rb 2016-03-07 23:31:30.000000000 +0100 @@ -94,6 +94,11 @@ through_record = through_association.build(*options_for_through_record) through_record.send("#{source_reflection.name}=", record) + + if options[:source_type] + through_record.send("#{source_reflection.foreign_type}=", options[:source_type]) + end + through_record end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/active_record/attribute_methods/dirty.rb new/lib/active_record/attribute_methods/dirty.rb --- old/lib/active_record/attribute_methods/dirty.rb 2016-02-29 20:16:01.000000000 +0100 +++ new/lib/active_record/attribute_methods/dirty.rb 2016-03-07 23:31:30.000000000 +0100 @@ -40,6 +40,7 @@ def initialize_dup(other) # :nodoc: super + @original_raw_attributes = nil calculate_changes_from_defaults end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/active_record/connection_adapters/abstract/database_statements.rb new/lib/active_record/connection_adapters/abstract/database_statements.rb --- old/lib/active_record/connection_adapters/abstract/database_statements.rb 2016-02-29 20:16:01.000000000 +0100 +++ new/lib/active_record/connection_adapters/abstract/database_statements.rb 2016-03-07 23:31:30.000000000 +0100 @@ -287,6 +287,7 @@ # Inserts the given fixture into the table. Overridden in adapters that require # something beyond a simple insert (eg. Oracle). def insert_fixture(fixture, table_name) + fixture = fixture.stringify_keys columns = schema_cache.columns_hash(table_name) key_list = [] @@ -295,7 +296,7 @@ key_list << quote_column_name(name) quote(value, column) else - raise Fixture::FixtureError, %(table "#{table_name}" has no column named "#{name}".) + raise Fixture::FixtureError, %(table "#{table_name}" has no column named #{name.inspect}.) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/active_record/connection_adapters/abstract/schema_definitions.rb new/lib/active_record/connection_adapters/abstract/schema_definitions.rb --- old/lib/active_record/connection_adapters/abstract/schema_definitions.rb 2016-02-29 20:16:01.000000000 +0100 +++ new/lib/active_record/connection_adapters/abstract/schema_definitions.rb 2016-03-07 23:31:30.000000000 +0100 @@ -99,7 +99,7 @@ def initialize(types, name, temporary, options, as = nil) @columns_hash = {} @indexes = {} - @foreign_keys = {} + @foreign_keys = [] @native = types @temporary = temporary @options = options @@ -289,7 +289,7 @@ end def foreign_key(table_name, options = {}) # :nodoc: - foreign_keys[table_name] = options + foreign_keys.push([table_name, options]) end # Appends <tt>:datetime</tt> columns <tt>:created_at</tt> and diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/active_record/connection_adapters/abstract/schema_statements.rb new/lib/active_record/connection_adapters/abstract/schema_statements.rb --- old/lib/active_record/connection_adapters/abstract/schema_statements.rb 2016-02-29 20:16:01.000000000 +0100 +++ new/lib/active_record/connection_adapters/abstract/schema_statements.rb 2016-03-07 23:31:30.000000000 +0100 @@ -19,6 +19,20 @@ table_name[0...table_alias_length].tr('.', '_') end + # Returns the relation names useable to back Active Record models. + # For most adapters this means all tables and views. + def data_sources + tables + end + + # Checks to see if the data source +name+ exists on the database. + # + # data_source_exists?(:ebooks) + # + def data_source_exists?(name) + data_sources.include?(name.to_s) + end + # Checks to see if the table +table_name+ exists on the database. # # table_exists?(:developers) @@ -213,7 +227,7 @@ end end - td.foreign_keys.each_pair do |other_table_name, foreign_key_options| + td.foreign_keys.each do |other_table_name, foreign_key_options| add_foreign_key(table_name, other_table_name, foreign_key_options) end @@ -876,11 +890,12 @@ end # Given a set of columns and an ORDER BY clause, returns the columns for a SELECT DISTINCT. - # Both PostgreSQL and Oracle overrides this for custom DISTINCT syntax - they + # PostgreSQL, MySQL, and Oracle overrides this for custom DISTINCT syntax - they # require the order columns appear in the SELECT. # # columns_for_distinct("posts.id", ["posts.created_at desc"]) - def columns_for_distinct(columns, orders) #:nodoc: + # + def columns_for_distinct(columns, orders) # :nodoc: columns end 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 2016-02-29 20:16:01.000000000 +0100 +++ new/lib/active_record/connection_adapters/abstract_mysql_adapter.rb 2016-03-07 23:31:30.000000000 +0100 @@ -407,6 +407,7 @@ result.collect { |field| field.first } end end + alias data_sources tables def truncate(table_name, name = nil) execute "TRUNCATE TABLE #{quote_table_name(table_name)}", name @@ -426,6 +427,7 @@ tables(nil, schema, table).any? end + alias data_source_exists? table_exists? # Returns an array of indexes for the given table. def indexes(table_name, name = nil) #:nodoc: @@ -604,8 +606,10 @@ # SHOW VARIABLES LIKE 'name' def show_variable(name) - variables = select_all("SHOW VARIABLES LIKE '#{name}'", 'SCHEMA') + variables = select_all("select @@#{name} as 'Value'", 'SCHEMA') variables.first['Value'] unless variables.empty? + rescue ActiveRecord::StatementInvalid + nil end # Returns a table's primary key and belonging sequence. @@ -648,6 +652,21 @@ end end + # In MySQL 5.7.5 and up, ONLY_FULL_GROUP_BY affects handling of queries that use + # DISTINCT and ORDER BY. It requires the ORDER BY columns in the select list for + # distinct queries, and requires that the ORDER BY include the distinct column. + # See https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html + def columns_for_distinct(columns, orders) # :nodoc: + order_columns = orders.reject(&:blank?).map { |s| + # Convert Arel node to string + s = s.to_sql unless s.is_a?(String) + # Remove any ASC/DESC modifiers + s.gsub(/\s+(?:ASC|DESC)\b/i, '') + }.reject(&:blank?).map.with_index { |column, i| "#{column} AS alias_#{i}" } + + [super, *order_columns].join(', ') + end + def strict_mode? self.class.type_cast_config_to_boolean(@config.fetch(:strict, true)) end @@ -713,6 +732,10 @@ subsubselect = select.clone subsubselect.projections = [key] + # Materialize subquery by adding distinct + # to work with MySQL 5.7.6 which sets optimizer_switch='derived_merge=on' + subsubselect.distinct unless select.limit || select.offset || select.orders.any? + subselect = Arel::SelectManager.new(select.engine) subselect.project Arel.sql(key.name) subselect.from subsubselect.as('__active_record_temp') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/active_record/connection_adapters/mysql_adapter.rb new/lib/active_record/connection_adapters/mysql_adapter.rb --- old/lib/active_record/connection_adapters/mysql_adapter.rb 2016-02-29 20:16:01.000000000 +0100 +++ new/lib/active_record/connection_adapters/mysql_adapter.rb 2016-03-07 23:31:30.000000000 +0100 @@ -245,7 +245,7 @@ return @client_encoding if @client_encoding result = exec_query( - "SHOW VARIABLES WHERE Variable_name = 'character_set_client'", + "select @@character_set_client", 'SCHEMA') @client_encoding = ENCODINGS[result.rows.last.last] 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 2016-02-29 20:16:01.000000000 +0100 +++ new/lib/active_record/connection_adapters/postgresql/schema_statements.rb 2016-03-07 23:31:30.000000000 +0100 @@ -95,6 +95,16 @@ SQL end + def data_sources # :nodoc + select_values(<<-SQL, 'SCHEMA') + SELECT c.relname + FROM pg_class c + LEFT JOIN pg_namespace n ON n.oid = c.relnamespace + WHERE c.relkind IN ('r', 'v','m') -- (r)elation/table, (v)iew, (m)aterialized view + AND n.nspname = ANY (current_schemas(false)) + SQL + end + # Returns true if table exists. # If the schema is not specified as part of +name+ then it will only find tables within # the current schema search path (regardless of permissions to access tables in other schemas) @@ -111,6 +121,7 @@ AND n.nspname = #{name.schema ? "'#{name.schema}'" : 'ANY (current_schemas(false))'} SQL end + alias data_source_exists? table_exists? def drop_table(table_name, options = {}) execute "DROP TABLE #{quote_table_name(table_name)}#{' CASCADE' if options[:force] == :cascade}" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/active_record/connection_adapters/sqlite3_adapter.rb new/lib/active_record/connection_adapters/sqlite3_adapter.rb --- old/lib/active_record/connection_adapters/sqlite3_adapter.rb 2016-02-29 20:16:01.000000000 +0100 +++ new/lib/active_record/connection_adapters/sqlite3_adapter.rb 2016-03-07 23:31:30.000000000 +0100 @@ -375,10 +375,12 @@ row['name'] end end + alias data_sources tables def table_exists?(table_name) table_name && tables(nil, table_name).any? end + alias data_source_exists? table_exists? # Returns an array of +Column+ objects for the table specified by +table_name+. def columns(table_name) #:nodoc: 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 2016-02-29 20:16:01.000000000 +0100 +++ new/lib/active_record/gem_version.rb 2016-03-07 23:31:30.000000000 +0100 @@ -7,8 +7,8 @@ module VERSION MAJOR = 4 MINOR = 2 - TINY = 5 - PRE = "2" + TINY = 6 + PRE = nil STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/active_record/reflection.rb new/lib/active_record/reflection.rb --- old/lib/active_record/reflection.rb 2016-02-29 20:16:01.000000000 +0100 +++ new/lib/active_record/reflection.rb 2016-03-07 23:31:30.000000000 +0100 @@ -327,7 +327,7 @@ end def foreign_key - @foreign_key ||= options[:foreign_key] || derive_foreign_key + @foreign_key ||= options[:foreign_key] || derive_foreign_key.freeze end def association_foreign_key diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/active_record/relation/spawn_methods.rb new/lib/active_record/relation/spawn_methods.rb --- old/lib/active_record/relation/spawn_methods.rb 2016-02-29 20:16:01.000000000 +0100 +++ new/lib/active_record/relation/spawn_methods.rb 2016-03-07 23:31:30.000000000 +0100 @@ -12,6 +12,7 @@ # Merges in the conditions from <tt>other</tt>, if <tt>other</tt> is an <tt>ActiveRecord::Relation</tt>. # Returns an array representing the intersection of the resulting records with <tt>other</tt>, if <tt>other</tt> is an array. + # # Post.where(published: true).joins(:comments).merge( Comment.where(spam: false) ) # # Performs a single join query with both where conditions. # @@ -37,11 +38,14 @@ end def merge!(other) # :nodoc: - if !other.is_a?(Relation) && other.respond_to?(:to_proc) + if other.is_a?(Hash) + Relation::HashMerger.new(self, other).merge + elsif other.is_a?(Relation) + Relation::Merger.new(self, other).merge + elsif other.respond_to?(:to_proc) instance_exec(&other) else - klass = other.is_a?(Hash) ? Relation::HashMerger : Relation::Merger - klass.new(self, other).merge + raise ArgumentError, "#{other.inspect} is not an ActiveRecord::Relation" end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/active_record/tasks/postgresql_database_tasks.rb new/lib/active_record/tasks/postgresql_database_tasks.rb --- old/lib/active_record/tasks/postgresql_database_tasks.rb 2016-02-29 20:16:01.000000000 +0100 +++ new/lib/active_record/tasks/postgresql_database_tasks.rb 2016-03-07 23:31:30.000000000 +0100 @@ -47,9 +47,9 @@ args = ['-s', '-x', '-O', '-f', filename] search_path = configuration['schema_search_path'] unless search_path.blank? - args << search_path.split(',').map do |part| + args += search_path.split(',').map do |part| "--schema=#{part.strip}" - end.join(' ') + end end args << configuration['database'] run_cmd('pg_dump', args, 'dumping') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2016-02-29 20:16:01.000000000 +0100 +++ new/metadata 2016-03-07 23:31:30.000000000 +0100 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: activerecord version: !ruby/object:Gem::Version - version: 4.2.5.2 + version: 4.2.6 platform: ruby authors: - David Heinemeier Hansson autorequire: bindir: bin cert_chain: [] -date: 2016-02-29 00:00:00.000000000 Z +date: 2016-03-07 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: activesupport @@ -16,28 +16,28 @@ requirements: - - '=' - !ruby/object:Gem::Version - version: 4.2.5.2 + version: 4.2.6 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version - version: 4.2.5.2 + version: 4.2.6 - !ruby/object:Gem::Dependency name: activemodel requirement: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version - version: 4.2.5.2 + version: 4.2.6 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version - version: 4.2.5.2 + version: 4.2.6 - !ruby/object:Gem::Dependency name: arel requirement: !ruby/object:Gem::Requirement