activerecord 5.2.3 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of activerecord might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +898 -532
- data/MIT-LICENSE +3 -1
- data/README.rdoc +7 -5
- data/examples/performance.rb +1 -1
- data/lib/active_record/aggregations.rb +5 -4
- data/lib/active_record/association_relation.rb +22 -12
- data/lib/active_record/associations/alias_tracker.rb +19 -16
- data/lib/active_record/associations/association.rb +95 -42
- data/lib/active_record/associations/association_scope.rb +21 -21
- data/lib/active_record/associations/belongs_to_association.rb +50 -46
- data/lib/active_record/associations/belongs_to_polymorphic_association.rb +1 -5
- data/lib/active_record/associations/builder/association.rb +23 -21
- data/lib/active_record/associations/builder/belongs_to.rb +29 -59
- data/lib/active_record/associations/builder/collection_association.rb +10 -19
- data/lib/active_record/associations/builder/has_and_belongs_to_many.rb +17 -41
- data/lib/active_record/associations/builder/has_many.rb +8 -2
- data/lib/active_record/associations/builder/has_one.rb +33 -2
- data/lib/active_record/associations/builder/singular_association.rb +3 -1
- data/lib/active_record/associations/collection_association.rb +31 -29
- data/lib/active_record/associations/collection_proxy.rb +25 -21
- data/lib/active_record/associations/foreign_association.rb +20 -0
- data/lib/active_record/associations/has_many_association.rb +26 -13
- data/lib/active_record/associations/has_many_through_association.rb +27 -28
- data/lib/active_record/associations/has_one_association.rb +43 -31
- data/lib/active_record/associations/has_one_through_association.rb +5 -5
- data/lib/active_record/associations/join_dependency/join_association.rb +54 -12
- data/lib/active_record/associations/join_dependency/join_part.rb +5 -5
- data/lib/active_record/associations/join_dependency.rb +91 -60
- data/lib/active_record/associations/preloader/association.rb +71 -43
- data/lib/active_record/associations/preloader/through_association.rb +49 -40
- data/lib/active_record/associations/preloader.rb +48 -35
- data/lib/active_record/associations/singular_association.rb +3 -17
- data/lib/active_record/associations/through_association.rb +1 -1
- data/lib/active_record/associations.rb +133 -25
- data/lib/active_record/attribute_assignment.rb +17 -19
- data/lib/active_record/attribute_methods/before_type_cast.rb +13 -7
- data/lib/active_record/attribute_methods/dirty.rb +101 -40
- data/lib/active_record/attribute_methods/primary_key.rb +20 -25
- data/lib/active_record/attribute_methods/query.rb +4 -8
- data/lib/active_record/attribute_methods/read.rb +14 -56
- data/lib/active_record/attribute_methods/serialization.rb +12 -7
- data/lib/active_record/attribute_methods/time_zone_conversion.rb +12 -15
- data/lib/active_record/attribute_methods/write.rb +18 -34
- data/lib/active_record/attribute_methods.rb +81 -143
- data/lib/active_record/attributes.rb +45 -8
- data/lib/active_record/autosave_association.rb +76 -47
- data/lib/active_record/base.rb +4 -17
- data/lib/active_record/callbacks.rb +158 -43
- data/lib/active_record/coders/yaml_column.rb +1 -2
- data/lib/active_record/connection_adapters/abstract/connection_pool.rb +293 -132
- data/lib/active_record/connection_adapters/abstract/database_limits.rb +7 -36
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +167 -146
- data/lib/active_record/connection_adapters/abstract/query_cache.rb +21 -17
- data/lib/active_record/connection_adapters/abstract/quoting.rb +98 -47
- data/lib/active_record/connection_adapters/abstract/savepoints.rb +3 -3
- data/lib/active_record/connection_adapters/abstract/schema_creation.rb +153 -110
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +203 -90
- data/lib/active_record/connection_adapters/abstract/schema_dumper.rb +2 -4
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +381 -146
- data/lib/active_record/connection_adapters/abstract/transaction.rb +155 -68
- data/lib/active_record/connection_adapters/abstract_adapter.rb +229 -98
- data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +243 -275
- data/lib/active_record/connection_adapters/column.rb +30 -12
- data/lib/active_record/connection_adapters/deduplicable.rb +29 -0
- data/lib/active_record/connection_adapters/legacy_pool_manager.rb +31 -0
- data/lib/active_record/connection_adapters/mysql/column.rb +1 -1
- data/lib/active_record/connection_adapters/mysql/database_statements.rb +86 -32
- data/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb +1 -2
- data/lib/active_record/connection_adapters/mysql/quoting.rb +44 -7
- data/lib/active_record/connection_adapters/mysql/schema_creation.rb +34 -10
- data/lib/active_record/connection_adapters/mysql/schema_definitions.rb +48 -32
- data/lib/active_record/connection_adapters/mysql/schema_dumper.rb +14 -6
- data/lib/active_record/connection_adapters/mysql/schema_statements.rb +139 -19
- data/lib/active_record/connection_adapters/mysql/type_metadata.rb +14 -9
- data/lib/active_record/connection_adapters/mysql2_adapter.rb +53 -18
- data/lib/active_record/connection_adapters/pool_config.rb +63 -0
- data/lib/active_record/connection_adapters/pool_manager.rb +43 -0
- data/lib/active_record/connection_adapters/postgresql/column.rb +37 -28
- data/lib/active_record/connection_adapters/postgresql/database_statements.rb +38 -54
- data/lib/active_record/connection_adapters/postgresql/oid/array.rb +1 -2
- data/lib/active_record/connection_adapters/postgresql/oid/bit.rb +1 -4
- data/lib/active_record/connection_adapters/postgresql/oid/cidr.rb +3 -5
- data/lib/active_record/connection_adapters/postgresql/oid/date.rb +2 -2
- data/lib/active_record/connection_adapters/postgresql/oid/date_time.rb +10 -2
- data/lib/active_record/connection_adapters/postgresql/oid/enum.rb +0 -1
- data/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +1 -2
- data/lib/active_record/connection_adapters/postgresql/oid/interval.rb +49 -0
- data/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb +3 -4
- data/lib/active_record/connection_adapters/postgresql/oid/macaddr.rb +25 -0
- data/lib/active_record/connection_adapters/postgresql/oid/money.rb +2 -2
- data/lib/active_record/connection_adapters/postgresql/oid/oid.rb +1 -1
- data/lib/active_record/connection_adapters/postgresql/oid/point.rb +3 -4
- data/lib/active_record/connection_adapters/postgresql/oid/range.rb +25 -7
- data/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb +1 -1
- data/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb +9 -7
- data/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +15 -3
- data/lib/active_record/connection_adapters/postgresql/oid.rb +2 -0
- data/lib/active_record/connection_adapters/postgresql/quoting.rb +47 -10
- data/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +2 -2
- data/lib/active_record/connection_adapters/postgresql/schema_creation.rb +19 -4
- data/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +107 -91
- data/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +0 -1
- data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +120 -100
- data/lib/active_record/connection_adapters/postgresql/type_metadata.rb +31 -26
- data/lib/active_record/connection_adapters/postgresql/utils.rb +0 -1
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +222 -112
- data/lib/active_record/connection_adapters/schema_cache.rb +127 -21
- data/lib/active_record/connection_adapters/sql_type_metadata.rb +19 -6
- data/lib/active_record/connection_adapters/sqlite3/database_statements.rb +144 -0
- data/lib/active_record/connection_adapters/sqlite3/quoting.rb +42 -7
- data/lib/active_record/connection_adapters/sqlite3/schema_creation.rb +5 -1
- data/lib/active_record/connection_adapters/sqlite3/schema_statements.rb +77 -13
- data/lib/active_record/connection_adapters/sqlite3_adapter.rb +175 -187
- data/lib/active_record/connection_adapters/statement_pool.rb +0 -1
- data/lib/active_record/connection_adapters.rb +50 -0
- data/lib/active_record/connection_handling.rb +285 -33
- data/lib/active_record/core.rb +308 -100
- data/lib/active_record/counter_cache.rb +8 -30
- data/lib/active_record/database_configurations/connection_url_resolver.rb +98 -0
- data/lib/active_record/database_configurations/database_config.rb +80 -0
- data/lib/active_record/database_configurations/hash_config.rb +96 -0
- data/lib/active_record/database_configurations/url_config.rb +53 -0
- data/lib/active_record/database_configurations.rb +272 -0
- data/lib/active_record/delegated_type.rb +209 -0
- data/lib/active_record/destroy_association_async_job.rb +36 -0
- data/lib/active_record/dynamic_matchers.rb +3 -4
- data/lib/active_record/enum.rb +71 -17
- data/lib/active_record/errors.rb +62 -19
- data/lib/active_record/explain.rb +10 -6
- data/lib/active_record/explain_subscriber.rb +1 -1
- data/lib/active_record/fixture_set/file.rb +10 -17
- data/lib/active_record/fixture_set/model_metadata.rb +32 -0
- data/lib/active_record/fixture_set/render_context.rb +17 -0
- data/lib/active_record/fixture_set/table_row.rb +152 -0
- data/lib/active_record/fixture_set/table_rows.rb +46 -0
- data/lib/active_record/fixtures.rb +197 -481
- data/lib/active_record/gem_version.rb +3 -3
- data/lib/active_record/inheritance.rb +53 -24
- data/lib/active_record/insert_all.rb +208 -0
- data/lib/active_record/integration.rb +67 -17
- data/lib/active_record/internal_metadata.rb +26 -9
- data/lib/active_record/legacy_yaml_adapter.rb +7 -3
- data/lib/active_record/locking/optimistic.rb +26 -22
- data/lib/active_record/locking/pessimistic.rb +9 -5
- data/lib/active_record/log_subscriber.rb +34 -35
- data/lib/active_record/middleware/database_selector/resolver/session.rb +48 -0
- data/lib/active_record/middleware/database_selector/resolver.rb +92 -0
- data/lib/active_record/middleware/database_selector.rb +77 -0
- data/lib/active_record/migration/command_recorder.rb +96 -44
- data/lib/active_record/migration/compatibility.rb +141 -64
- data/lib/active_record/migration/join_table.rb +0 -1
- data/lib/active_record/migration.rb +205 -156
- data/lib/active_record/model_schema.rb +148 -22
- data/lib/active_record/nested_attributes.rb +4 -7
- data/lib/active_record/no_touching.rb +8 -1
- data/lib/active_record/null_relation.rb +0 -1
- data/lib/active_record/persistence.rb +267 -59
- data/lib/active_record/query_cache.rb +21 -4
- data/lib/active_record/querying.rb +40 -23
- data/lib/active_record/railtie.rb +115 -58
- data/lib/active_record/railties/controller_runtime.rb +30 -35
- data/lib/active_record/railties/databases.rake +402 -78
- data/lib/active_record/readonly_attributes.rb +4 -0
- data/lib/active_record/reflection.rb +113 -101
- data/lib/active_record/relation/batches/batch_enumerator.rb +25 -9
- data/lib/active_record/relation/batches.rb +44 -35
- data/lib/active_record/relation/calculations.rb +157 -93
- data/lib/active_record/relation/delegation.rb +35 -50
- data/lib/active_record/relation/finder_methods.rb +65 -40
- data/lib/active_record/relation/from_clause.rb +5 -1
- data/lib/active_record/relation/merger.rb +32 -40
- data/lib/active_record/relation/predicate_builder/array_handler.rb +13 -13
- data/lib/active_record/relation/predicate_builder/association_query_value.rb +5 -9
- data/lib/active_record/relation/predicate_builder/basic_object_handler.rb +1 -2
- data/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb +4 -7
- data/lib/active_record/relation/predicate_builder/range_handler.rb +3 -23
- data/lib/active_record/relation/predicate_builder/relation_handler.rb +1 -1
- data/lib/active_record/relation/predicate_builder.rb +58 -40
- data/lib/active_record/relation/query_attribute.rb +13 -8
- data/lib/active_record/relation/query_methods.rb +487 -199
- data/lib/active_record/relation/record_fetch_warning.rb +3 -3
- data/lib/active_record/relation/spawn_methods.rb +9 -9
- data/lib/active_record/relation/where_clause.rb +108 -58
- data/lib/active_record/relation.rb +375 -104
- data/lib/active_record/result.rb +64 -38
- data/lib/active_record/runtime_registry.rb +2 -2
- data/lib/active_record/sanitization.rb +22 -41
- data/lib/active_record/schema.rb +2 -11
- data/lib/active_record/schema_dumper.rb +54 -9
- data/lib/active_record/schema_migration.rb +7 -9
- data/lib/active_record/scoping/default.rb +6 -8
- data/lib/active_record/scoping/named.rb +17 -24
- data/lib/active_record/scoping.rb +8 -9
- data/lib/active_record/secure_token.rb +16 -8
- data/lib/active_record/serialization.rb +5 -3
- data/lib/active_record/signed_id.rb +116 -0
- data/lib/active_record/statement_cache.rb +51 -8
- data/lib/active_record/store.rb +88 -9
- data/lib/active_record/suppressor.rb +2 -2
- data/lib/active_record/table_metadata.rb +39 -43
- data/lib/active_record/tasks/database_tasks.rb +276 -81
- data/lib/active_record/tasks/mysql_database_tasks.rb +37 -39
- data/lib/active_record/tasks/postgresql_database_tasks.rb +27 -32
- data/lib/active_record/tasks/sqlite_database_tasks.rb +14 -17
- data/lib/active_record/test_databases.rb +24 -0
- data/lib/active_record/test_fixtures.rb +246 -0
- data/lib/active_record/timestamp.rb +43 -32
- data/lib/active_record/touch_later.rb +23 -22
- data/lib/active_record/transactions.rb +59 -117
- data/lib/active_record/translation.rb +1 -1
- data/lib/active_record/type/adapter_specific_registry.rb +3 -13
- data/lib/active_record/type/hash_lookup_type_map.rb +0 -1
- data/lib/active_record/type/serialized.rb +6 -3
- data/lib/active_record/type/time.rb +10 -0
- data/lib/active_record/type/type_map.rb +0 -1
- data/lib/active_record/type/unsigned_integer.rb +0 -1
- data/lib/active_record/type.rb +10 -5
- data/lib/active_record/type_caster/connection.rb +15 -15
- data/lib/active_record/type_caster/map.rb +8 -8
- data/lib/active_record/validations/associated.rb +1 -2
- data/lib/active_record/validations/numericality.rb +35 -0
- data/lib/active_record/validations/uniqueness.rb +38 -30
- data/lib/active_record/validations.rb +4 -3
- data/lib/active_record.rb +13 -12
- data/lib/arel/alias_predication.rb +9 -0
- data/lib/arel/attributes/attribute.rb +41 -0
- data/lib/arel/collectors/bind.rb +29 -0
- data/lib/arel/collectors/composite.rb +39 -0
- data/lib/arel/collectors/plain_string.rb +20 -0
- data/lib/arel/collectors/sql_string.rb +27 -0
- data/lib/arel/collectors/substitute_binds.rb +35 -0
- data/lib/arel/crud.rb +42 -0
- data/lib/arel/delete_manager.rb +18 -0
- data/lib/arel/errors.rb +9 -0
- data/lib/arel/expressions.rb +29 -0
- data/lib/arel/factory_methods.rb +49 -0
- data/lib/arel/insert_manager.rb +49 -0
- data/lib/arel/math.rb +45 -0
- data/lib/arel/nodes/and.rb +32 -0
- data/lib/arel/nodes/ascending.rb +23 -0
- data/lib/arel/nodes/binary.rb +126 -0
- data/lib/arel/nodes/bind_param.rb +44 -0
- data/lib/arel/nodes/case.rb +55 -0
- data/lib/arel/nodes/casted.rb +62 -0
- data/lib/arel/nodes/comment.rb +29 -0
- data/lib/arel/nodes/count.rb +12 -0
- data/lib/arel/nodes/delete_statement.rb +45 -0
- data/lib/arel/nodes/descending.rb +23 -0
- data/lib/arel/nodes/equality.rb +15 -0
- data/lib/arel/nodes/extract.rb +24 -0
- data/lib/arel/nodes/false.rb +16 -0
- data/lib/arel/nodes/full_outer_join.rb +8 -0
- data/lib/arel/nodes/function.rb +44 -0
- data/lib/arel/nodes/grouping.rb +11 -0
- data/lib/arel/nodes/homogeneous_in.rb +72 -0
- data/lib/arel/nodes/in.rb +15 -0
- data/lib/arel/nodes/infix_operation.rb +92 -0
- data/lib/arel/nodes/inner_join.rb +8 -0
- data/lib/arel/nodes/insert_statement.rb +37 -0
- data/lib/arel/nodes/join_source.rb +20 -0
- data/lib/arel/nodes/matches.rb +18 -0
- data/lib/arel/nodes/named_function.rb +23 -0
- data/lib/arel/nodes/node.rb +51 -0
- data/lib/arel/nodes/node_expression.rb +13 -0
- data/lib/arel/nodes/ordering.rb +27 -0
- data/lib/arel/nodes/outer_join.rb +8 -0
- data/lib/arel/nodes/over.rb +15 -0
- data/lib/arel/nodes/regexp.rb +16 -0
- data/lib/arel/nodes/right_outer_join.rb +8 -0
- data/lib/arel/nodes/select_core.rb +67 -0
- data/lib/arel/nodes/select_statement.rb +41 -0
- data/lib/arel/nodes/sql_literal.rb +19 -0
- data/lib/arel/nodes/string_join.rb +11 -0
- data/lib/arel/nodes/table_alias.rb +31 -0
- data/lib/arel/nodes/terminal.rb +16 -0
- data/lib/arel/nodes/true.rb +16 -0
- data/lib/arel/nodes/unary.rb +44 -0
- data/lib/arel/nodes/unary_operation.rb +20 -0
- data/lib/arel/nodes/unqualified_column.rb +22 -0
- data/lib/arel/nodes/update_statement.rb +41 -0
- data/lib/arel/nodes/values_list.rb +9 -0
- data/lib/arel/nodes/window.rb +126 -0
- data/lib/arel/nodes/with.rb +11 -0
- data/lib/arel/nodes.rb +70 -0
- data/lib/arel/order_predications.rb +13 -0
- data/lib/arel/predications.rb +250 -0
- data/lib/arel/select_manager.rb +270 -0
- data/lib/arel/table.rb +118 -0
- data/lib/arel/tree_manager.rb +72 -0
- data/lib/arel/update_manager.rb +34 -0
- data/lib/arel/visitors/dot.rb +308 -0
- data/lib/arel/visitors/mysql.rb +93 -0
- data/lib/arel/visitors/postgresql.rb +120 -0
- data/lib/arel/visitors/sqlite.rb +38 -0
- data/lib/arel/visitors/to_sql.rb +899 -0
- data/lib/arel/visitors/visitor.rb +45 -0
- data/lib/arel/visitors.rb +13 -0
- data/lib/arel/window_predications.rb +9 -0
- data/lib/arel.rb +54 -0
- data/lib/rails/generators/active_record/application_record/application_record_generator.rb +0 -1
- data/lib/rails/generators/active_record/migration/migration_generator.rb +3 -5
- data/lib/rails/generators/active_record/migration/templates/create_table_migration.rb.tt +3 -1
- data/lib/rails/generators/active_record/migration/templates/migration.rb.tt +7 -5
- data/lib/rails/generators/active_record/migration.rb +19 -2
- data/lib/rails/generators/active_record/model/model_generator.rb +39 -2
- data/lib/rails/generators/active_record/model/templates/abstract_base_class.rb.tt +7 -0
- data/lib/rails/generators/active_record/model/templates/model.rb.tt +10 -1
- metadata +117 -32
- data/lib/active_record/attribute_decorators.rb +0 -90
- data/lib/active_record/collection_cache_key.rb +0 -53
- data/lib/active_record/connection_adapters/connection_specification.rb +0 -287
- data/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb +0 -33
- data/lib/active_record/define_callbacks.rb +0 -22
- data/lib/active_record/relation/predicate_builder/base_handler.rb +0 -19
- data/lib/active_record/relation/where_clause_factory.rb +0 -34
| @@ -0,0 +1,45 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Arel # :nodoc: all
         | 
| 4 | 
            +
              module Visitors
         | 
| 5 | 
            +
                class Visitor
         | 
| 6 | 
            +
                  def initialize
         | 
| 7 | 
            +
                    @dispatch = get_dispatch_cache
         | 
| 8 | 
            +
                  end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                  def accept(object, collector = nil)
         | 
| 11 | 
            +
                    visit object, collector
         | 
| 12 | 
            +
                  end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                  private
         | 
| 15 | 
            +
                    attr_reader :dispatch
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                    def self.dispatch_cache
         | 
| 18 | 
            +
                      @dispatch_cache ||= Hash.new do |hash, klass|
         | 
| 19 | 
            +
                        hash[klass] = "visit_#{(klass.name || '').gsub('::', '_')}"
         | 
| 20 | 
            +
                      end
         | 
| 21 | 
            +
                    end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                    def get_dispatch_cache
         | 
| 24 | 
            +
                      self.class.dispatch_cache
         | 
| 25 | 
            +
                    end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                    def visit(object, collector = nil)
         | 
| 28 | 
            +
                      dispatch_method = dispatch[object.class]
         | 
| 29 | 
            +
                      if collector
         | 
| 30 | 
            +
                        send dispatch_method, object, collector
         | 
| 31 | 
            +
                      else
         | 
| 32 | 
            +
                        send dispatch_method, object
         | 
| 33 | 
            +
                      end
         | 
| 34 | 
            +
                    rescue NoMethodError => e
         | 
| 35 | 
            +
                      raise e if respond_to?(dispatch_method, true)
         | 
| 36 | 
            +
                      superklass = object.class.ancestors.find { |klass|
         | 
| 37 | 
            +
                        respond_to?(dispatch[klass], true)
         | 
| 38 | 
            +
                      }
         | 
| 39 | 
            +
                      raise(TypeError, "Cannot visit #{object.class}") unless superklass
         | 
| 40 | 
            +
                      dispatch[object.class] = dispatch[superklass]
         | 
| 41 | 
            +
                      retry
         | 
| 42 | 
            +
                    end
         | 
| 43 | 
            +
                end
         | 
| 44 | 
            +
              end
         | 
| 45 | 
            +
            end
         | 
| @@ -0,0 +1,13 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require "arel/visitors/visitor"
         | 
| 4 | 
            +
            require "arel/visitors/to_sql"
         | 
| 5 | 
            +
            require "arel/visitors/sqlite"
         | 
| 6 | 
            +
            require "arel/visitors/postgresql"
         | 
| 7 | 
            +
            require "arel/visitors/mysql"
         | 
| 8 | 
            +
            require "arel/visitors/dot"
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            module Arel # :nodoc: all
         | 
| 11 | 
            +
              module Visitors
         | 
| 12 | 
            +
              end
         | 
| 13 | 
            +
            end
         | 
    
        data/lib/arel.rb
    ADDED
    
    | @@ -0,0 +1,54 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require "arel/errors"
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            require "arel/crud"
         | 
| 6 | 
            +
            require "arel/factory_methods"
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            require "arel/expressions"
         | 
| 9 | 
            +
            require "arel/predications"
         | 
| 10 | 
            +
            require "arel/window_predications"
         | 
| 11 | 
            +
            require "arel/math"
         | 
| 12 | 
            +
            require "arel/alias_predication"
         | 
| 13 | 
            +
            require "arel/order_predications"
         | 
| 14 | 
            +
            require "arel/table"
         | 
| 15 | 
            +
            require "arel/attributes/attribute"
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            require "arel/visitors"
         | 
| 18 | 
            +
            require "arel/collectors/sql_string"
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            require "arel/tree_manager"
         | 
| 21 | 
            +
            require "arel/insert_manager"
         | 
| 22 | 
            +
            require "arel/select_manager"
         | 
| 23 | 
            +
            require "arel/update_manager"
         | 
| 24 | 
            +
            require "arel/delete_manager"
         | 
| 25 | 
            +
            require "arel/nodes"
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            module Arel
         | 
| 28 | 
            +
              VERSION = "10.0.0"
         | 
| 29 | 
            +
             | 
| 30 | 
            +
              # Wrap a known-safe SQL string for passing to query methods, e.g.
         | 
| 31 | 
            +
              #
         | 
| 32 | 
            +
              #   Post.order(Arel.sql("length(title)")).last
         | 
| 33 | 
            +
              #
         | 
| 34 | 
            +
              # Great caution should be taken to avoid SQL injection vulnerabilities.
         | 
| 35 | 
            +
              # This method should not be used with unsafe values such as request
         | 
| 36 | 
            +
              # parameters or model attributes.
         | 
| 37 | 
            +
              def self.sql(raw_sql)
         | 
| 38 | 
            +
                Arel::Nodes::SqlLiteral.new raw_sql
         | 
| 39 | 
            +
              end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
              def self.star # :nodoc:
         | 
| 42 | 
            +
                sql "*"
         | 
| 43 | 
            +
              end
         | 
| 44 | 
            +
             | 
| 45 | 
            +
              def self.arel_node?(value) # :nodoc:
         | 
| 46 | 
            +
                value.is_a?(Arel::Nodes::Node) || value.is_a?(Arel::Attribute) || value.is_a?(Arel::Nodes::SqlLiteral)
         | 
| 47 | 
            +
              end
         | 
| 48 | 
            +
             | 
| 49 | 
            +
              def self.fetch_attribute(value, &block) # :nodoc:
         | 
| 50 | 
            +
                unless String === value
         | 
| 51 | 
            +
                  value.fetch_attribute(&block)
         | 
| 52 | 
            +
                end
         | 
| 53 | 
            +
              end
         | 
| 54 | 
            +
            end
         | 
| @@ -7,7 +7,9 @@ module ActiveRecord | |
| 7 7 | 
             
                class MigrationGenerator < Base # :nodoc:
         | 
| 8 8 | 
             
                  argument :attributes, type: :array, default: [], banner: "field[:type][:index] field[:type][:index]"
         | 
| 9 9 |  | 
| 10 | 
            +
                  class_option :timestamps, type: :boolean
         | 
| 10 11 | 
             
                  class_option :primary_key_type, type: :string, desc: "The type for primary key"
         | 
| 12 | 
            +
                  class_option :database, type: :string, aliases: %i(--db), desc: "The database for your migration. By default, the current environment's primary database is used."
         | 
| 11 13 |  | 
| 12 14 | 
             
                  def create_migration_file
         | 
| 13 15 | 
             
                    set_local_assigns!
         | 
| @@ -15,12 +17,8 @@ module ActiveRecord | |
| 15 17 | 
             
                    migration_template @migration_template, File.join(db_migrate_path, "#{file_name}.rb")
         | 
| 16 18 | 
             
                  end
         | 
| 17 19 |  | 
| 18 | 
            -
                  # TODO Change this to private once we've dropped Ruby 2.2 support.
         | 
| 19 | 
            -
                  # Workaround for Ruby 2.2 "private attribute?" warning.
         | 
| 20 | 
            -
                  protected
         | 
| 21 | 
            -
                    attr_reader :migration_action, :join_tables
         | 
| 22 | 
            -
             | 
| 23 20 | 
             
                  private
         | 
| 21 | 
            +
                    attr_reader :migration_action, :join_tables
         | 
| 24 22 |  | 
| 25 23 | 
             
                    # Sets the default migration template that is being used for the generation of the migration.
         | 
| 26 24 | 
             
                    # Depending on command line arguments, the migration template and the table name instance
         | 
| @@ -6,7 +6,9 @@ class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Mi | |
| 6 6 | 
             
                  t.string :password_digest<%= attribute.inject_options %>
         | 
| 7 7 | 
             
            <% elsif attribute.token? -%>
         | 
| 8 8 | 
             
                  t.string :<%= attribute.name %><%= attribute.inject_options %>
         | 
| 9 | 
            -
            <%  | 
| 9 | 
            +
            <% elsif attribute.reference? -%>
         | 
| 10 | 
            +
                  t.<%= attribute.type %> :<%= attribute.name %><%= attribute.inject_options %><%= foreign_key_type %>
         | 
| 11 | 
            +
            <% elsif !attribute.virtual? -%>
         | 
| 10 12 | 
             
                  t.<%= attribute.type %> :<%= attribute.name %><%= attribute.inject_options %>
         | 
| 11 13 | 
             
            <% end -%>
         | 
| 12 14 | 
             
            <% end -%>
         | 
| @@ -3,11 +3,11 @@ class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Mi | |
| 3 3 | 
             
              def change
         | 
| 4 4 | 
             
            <% attributes.each do |attribute| -%>
         | 
| 5 5 | 
             
              <%- if attribute.reference? -%>
         | 
| 6 | 
            -
                add_reference :<%= table_name %>, :<%= attribute.name %><%= attribute.inject_options %>
         | 
| 6 | 
            +
                add_reference :<%= table_name %>, :<%= attribute.name %><%= attribute.inject_options %><%= foreign_key_type %>
         | 
| 7 7 | 
             
              <%- elsif attribute.token? -%>
         | 
| 8 8 | 
             
                add_column :<%= table_name %>, :<%= attribute.name %>, :string<%= attribute.inject_options %>
         | 
| 9 9 | 
             
                add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>, unique: true
         | 
| 10 | 
            -
              <%-  | 
| 10 | 
            +
              <%- elsif !attribute.virtual? -%>
         | 
| 11 11 | 
             
                add_column :<%= table_name %>, :<%= attribute.name %>, :<%= attribute.type %><%= attribute.inject_options %>
         | 
| 12 12 | 
             
                <%- if attribute.has_index? -%>
         | 
| 13 13 | 
             
                add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>
         | 
| @@ -20,8 +20,8 @@ class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Mi | |
| 20 20 | 
             
                create_join_table :<%= join_tables.first %>, :<%= join_tables.second %> do |t|
         | 
| 21 21 | 
             
                <%- attributes.each do |attribute| -%>
         | 
| 22 22 | 
             
                  <%- if attribute.reference? -%>
         | 
| 23 | 
            -
                  t.references :<%= attribute.name %><%= attribute.inject_options %>
         | 
| 24 | 
            -
                  <%-  | 
| 23 | 
            +
                  t.references :<%= attribute.name %><%= attribute.inject_options %><%= foreign_key_type %>
         | 
| 24 | 
            +
                  <%- elsif !attribute.virtual? -%>
         | 
| 25 25 | 
             
                  <%= '# ' unless attribute.has_index? -%>t.index <%= attribute.index_name %><%= attribute.inject_index_options %>
         | 
| 26 26 | 
             
                  <%- end -%>
         | 
| 27 27 | 
             
                <%- end -%>
         | 
| @@ -32,12 +32,14 @@ class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Mi | |
| 32 32 | 
             
            <% attributes.each do |attribute| -%>
         | 
| 33 33 | 
             
            <%- if migration_action -%>
         | 
| 34 34 | 
             
              <%- if attribute.reference? -%>
         | 
| 35 | 
            -
                remove_reference :<%= table_name %>, :<%= attribute.name %><%= attribute.inject_options %>
         | 
| 35 | 
            +
                remove_reference :<%= table_name %>, :<%= attribute.name %><%= attribute.inject_options %><%= foreign_key_type %>
         | 
| 36 36 | 
             
              <%- else -%>
         | 
| 37 37 | 
             
                <%- if attribute.has_index? -%>
         | 
| 38 38 | 
             
                remove_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>
         | 
| 39 39 | 
             
                <%- end -%>
         | 
| 40 | 
            +
                <%- if !attribute.virtual? -%>
         | 
| 40 41 | 
             
                remove_column :<%= table_name %>, :<%= attribute.name %>, :<%= attribute.type %><%= attribute.inject_options %>
         | 
| 42 | 
            +
                <%- end -%>
         | 
| 41 43 | 
             
              <%- end -%>
         | 
| 42 44 | 
             
            <%- end -%>
         | 
| 43 45 | 
             
            <%- end -%>
         | 
| @@ -17,19 +17,36 @@ module ActiveRecord | |
| 17 17 | 
             
                  end
         | 
| 18 18 |  | 
| 19 19 | 
             
                  private
         | 
| 20 | 
            -
             | 
| 21 20 | 
             
                    def primary_key_type
         | 
| 22 21 | 
             
                      key_type = options[:primary_key_type]
         | 
| 23 22 | 
             
                      ", id: :#{key_type}" if key_type
         | 
| 24 23 | 
             
                    end
         | 
| 25 24 |  | 
| 25 | 
            +
                    def foreign_key_type
         | 
| 26 | 
            +
                      key_type = options[:primary_key_type]
         | 
| 27 | 
            +
                      ", type: :#{key_type}" if key_type
         | 
| 28 | 
            +
                    end
         | 
| 29 | 
            +
             | 
| 26 30 | 
             
                    def db_migrate_path
         | 
| 27 31 | 
             
                      if defined?(Rails.application) && Rails.application
         | 
| 28 | 
            -
                         | 
| 32 | 
            +
                        configured_migrate_path || default_migrate_path
         | 
| 29 33 | 
             
                      else
         | 
| 30 34 | 
             
                        "db/migrate"
         | 
| 31 35 | 
             
                      end
         | 
| 32 36 | 
             
                    end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                    def default_migrate_path
         | 
| 39 | 
            +
                      Rails.application.config.paths["db/migrate"].to_ary.first
         | 
| 40 | 
            +
                    end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                    def configured_migrate_path
         | 
| 43 | 
            +
                      return unless database = options[:database]
         | 
| 44 | 
            +
                      config = ActiveRecord::Base.configurations.configs_for(
         | 
| 45 | 
            +
                        env_name: Rails.env,
         | 
| 46 | 
            +
                        name: database
         | 
| 47 | 
            +
                      )
         | 
| 48 | 
            +
                      config&.migrations_paths
         | 
| 49 | 
            +
                    end
         | 
| 33 50 | 
             
                end
         | 
| 34 51 | 
             
              end
         | 
| 35 52 | 
             
            end
         | 
| @@ -14,15 +14,17 @@ module ActiveRecord | |
| 14 14 | 
             
                  class_option :parent, type: :string, desc: "The parent class for the generated model"
         | 
| 15 15 | 
             
                  class_option :indexes, type: :boolean, default: true, desc: "Add indexes for references and belongs_to columns"
         | 
| 16 16 | 
             
                  class_option :primary_key_type, type: :string, desc: "The type for primary key"
         | 
| 17 | 
            +
                  class_option :database, type: :string, aliases: %i(--db), desc: "The database for your model's migration. By default, the current environment's primary database is used."
         | 
| 17 18 |  | 
| 18 19 | 
             
                  # creates the migration file for the model.
         | 
| 19 20 | 
             
                  def create_migration_file
         | 
| 20 | 
            -
                    return  | 
| 21 | 
            +
                    return if skip_migration_creation?
         | 
| 21 22 | 
             
                    attributes.each { |a| a.attr_options.delete(:index) if a.reference? && !a.has_index? } if options[:indexes] == false
         | 
| 22 23 | 
             
                    migration_template "../../migration/templates/create_table_migration.rb", File.join(db_migrate_path, "create_#{table_name}.rb")
         | 
| 23 24 | 
             
                  end
         | 
| 24 25 |  | 
| 25 26 | 
             
                  def create_model_file
         | 
| 27 | 
            +
                    generate_abstract_class if database && !parent
         | 
| 26 28 | 
             
                    template "model.rb", File.join("app/models", class_path, "#{file_name}.rb")
         | 
| 27 29 | 
             
                  end
         | 
| 28 30 |  | 
| @@ -34,6 +36,12 @@ module ActiveRecord | |
| 34 36 | 
             
                  hook_for :test_framework
         | 
| 35 37 |  | 
| 36 38 | 
             
                  private
         | 
| 39 | 
            +
                    # Skip creating migration file if:
         | 
| 40 | 
            +
                    #   - options parent is present and database option is not present
         | 
| 41 | 
            +
                    #   - migrations option is nil or false
         | 
| 42 | 
            +
                    def skip_migration_creation?
         | 
| 43 | 
            +
                      parent && !database || !migration
         | 
| 44 | 
            +
                    end
         | 
| 37 45 |  | 
| 38 46 | 
             
                    def attributes_with_index
         | 
| 39 47 | 
             
                      attributes.select { |a| !a.reference? && a.has_index? }
         | 
| @@ -41,7 +49,36 @@ module ActiveRecord | |
| 41 49 |  | 
| 42 50 | 
             
                    # Used by the migration template to determine the parent name of the model
         | 
| 43 51 | 
             
                    def parent_class_name
         | 
| 44 | 
            -
                       | 
| 52 | 
            +
                      if parent
         | 
| 53 | 
            +
                        parent
         | 
| 54 | 
            +
                      elsif database
         | 
| 55 | 
            +
                        abstract_class_name
         | 
| 56 | 
            +
                      else
         | 
| 57 | 
            +
                        "ApplicationRecord"
         | 
| 58 | 
            +
                      end
         | 
| 59 | 
            +
                    end
         | 
| 60 | 
            +
             | 
| 61 | 
            +
                    def generate_abstract_class
         | 
| 62 | 
            +
                      path = File.join("app/models", "#{database.underscore}_record.rb")
         | 
| 63 | 
            +
                      return if File.exist?(path)
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                      template "abstract_base_class.rb", path
         | 
| 66 | 
            +
                    end
         | 
| 67 | 
            +
             | 
| 68 | 
            +
                    def abstract_class_name
         | 
| 69 | 
            +
                      "#{database.camelize}Record"
         | 
| 70 | 
            +
                    end
         | 
| 71 | 
            +
             | 
| 72 | 
            +
                    def database
         | 
| 73 | 
            +
                      options[:database]
         | 
| 74 | 
            +
                    end
         | 
| 75 | 
            +
             | 
| 76 | 
            +
                    def parent
         | 
| 77 | 
            +
                      options[:parent]
         | 
| 78 | 
            +
                    end
         | 
| 79 | 
            +
             | 
| 80 | 
            +
                    def migration
         | 
| 81 | 
            +
                      options[:migration]
         | 
| 45 82 | 
             
                    end
         | 
| 46 83 | 
             
                end
         | 
| 47 84 | 
             
              end
         | 
| @@ -1,7 +1,16 @@ | |
| 1 1 | 
             
            <% module_namespacing do -%>
         | 
| 2 2 | 
             
            class <%= class_name %> < <%= parent_class_name.classify %>
         | 
| 3 3 | 
             
            <% attributes.select(&:reference?).each do |attribute| -%>
         | 
| 4 | 
            -
              belongs_to :<%= attribute.name %><%= ', polymorphic: true' if attribute.polymorphic?  | 
| 4 | 
            +
              belongs_to :<%= attribute.name %><%= ', polymorphic: true' if attribute.polymorphic? %>
         | 
| 5 | 
            +
            <% end -%>
         | 
| 6 | 
            +
            <% attributes.select(&:rich_text?).each do |attribute| -%>
         | 
| 7 | 
            +
              has_rich_text :<%= attribute.name %>
         | 
| 8 | 
            +
            <% end -%>
         | 
| 9 | 
            +
            <% attributes.select(&:attachment?).each do |attribute| -%>
         | 
| 10 | 
            +
              has_one_attached :<%= attribute.name %>
         | 
| 11 | 
            +
            <% end -%>
         | 
| 12 | 
            +
            <% attributes.select(&:attachments?).each do |attribute| -%>
         | 
| 13 | 
            +
              has_many_attached :<%= attribute.name %>
         | 
| 5 14 | 
             
            <% end -%>
         | 
| 6 15 | 
             
            <% attributes.select(&:token?).each do |attribute| -%>
         | 
| 7 16 | 
             
              has_secure_token<% if attribute.name != "token" %> :<%= attribute.name %><% end %>
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: activerecord
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version:  | 
| 4 | 
            +
              version: 6.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - David Heinemeier Hansson
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2020-12-09 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activesupport
         | 
| @@ -16,42 +16,28 @@ dependencies: | |
| 16 16 | 
             
                requirements:
         | 
| 17 17 | 
             
                - - '='
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version:  | 
| 19 | 
            +
                    version: 6.1.0
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 24 | 
             
                - - '='
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version:  | 
| 26 | 
            +
                    version: 6.1.0
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: activemodel
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 30 | 
             
                requirements:
         | 
| 31 31 | 
             
                - - '='
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version:  | 
| 33 | 
            +
                    version: 6.1.0
         | 
| 34 34 | 
             
              type: :runtime
         | 
| 35 35 | 
             
              prerelease: false
         | 
| 36 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 37 | 
             
                requirements:
         | 
| 38 38 | 
             
                - - '='
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version:  | 
| 41 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            -
              name: arel
         | 
| 43 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 | 
            -
                requirements:
         | 
| 45 | 
            -
                - - ">="
         | 
| 46 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            -
                    version: '9.0'
         | 
| 48 | 
            -
              type: :runtime
         | 
| 49 | 
            -
              prerelease: false
         | 
| 50 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 | 
            -
                requirements:
         | 
| 52 | 
            -
                - - ">="
         | 
| 53 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            -
                    version: '9.0'
         | 
| 40 | 
            +
                    version: 6.1.0
         | 
| 55 41 | 
             
            description: Databases on Rails. Build a persistent domain model by mapping database
         | 
| 56 42 | 
             
              tables to Ruby classes. Strong conventions for associations, validations, aggregations,
         | 
| 57 43 | 
             
              migrations, and testing come baked-in.
         | 
| @@ -99,7 +85,6 @@ files: | |
| 99 85 | 
             
            - lib/active_record/associations/singular_association.rb
         | 
| 100 86 | 
             
            - lib/active_record/associations/through_association.rb
         | 
| 101 87 | 
             
            - lib/active_record/attribute_assignment.rb
         | 
| 102 | 
            -
            - lib/active_record/attribute_decorators.rb
         | 
| 103 88 | 
             
            - lib/active_record/attribute_methods.rb
         | 
| 104 89 | 
             
            - lib/active_record/attribute_methods/before_type_cast.rb
         | 
| 105 90 | 
             
            - lib/active_record/attribute_methods/dirty.rb
         | 
| @@ -115,7 +100,7 @@ files: | |
| 115 100 | 
             
            - lib/active_record/callbacks.rb
         | 
| 116 101 | 
             
            - lib/active_record/coders/json.rb
         | 
| 117 102 | 
             
            - lib/active_record/coders/yaml_column.rb
         | 
| 118 | 
            -
            - lib/active_record/ | 
| 103 | 
            +
            - lib/active_record/connection_adapters.rb
         | 
| 119 104 | 
             
            - lib/active_record/connection_adapters/abstract/connection_pool.rb
         | 
| 120 105 | 
             
            - lib/active_record/connection_adapters/abstract/database_limits.rb
         | 
| 121 106 | 
             
            - lib/active_record/connection_adapters/abstract/database_statements.rb
         | 
| @@ -130,8 +115,8 @@ files: | |
| 130 115 | 
             
            - lib/active_record/connection_adapters/abstract_adapter.rb
         | 
| 131 116 | 
             
            - lib/active_record/connection_adapters/abstract_mysql_adapter.rb
         | 
| 132 117 | 
             
            - lib/active_record/connection_adapters/column.rb
         | 
| 133 | 
            -
            - lib/active_record/connection_adapters/ | 
| 134 | 
            -
            - lib/active_record/connection_adapters/ | 
| 118 | 
            +
            - lib/active_record/connection_adapters/deduplicable.rb
         | 
| 119 | 
            +
            - lib/active_record/connection_adapters/legacy_pool_manager.rb
         | 
| 135 120 | 
             
            - lib/active_record/connection_adapters/mysql/column.rb
         | 
| 136 121 | 
             
            - lib/active_record/connection_adapters/mysql/database_statements.rb
         | 
| 137 122 | 
             
            - lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb
         | 
| @@ -142,6 +127,8 @@ files: | |
| 142 127 | 
             
            - lib/active_record/connection_adapters/mysql/schema_statements.rb
         | 
| 143 128 | 
             
            - lib/active_record/connection_adapters/mysql/type_metadata.rb
         | 
| 144 129 | 
             
            - lib/active_record/connection_adapters/mysql2_adapter.rb
         | 
| 130 | 
            +
            - lib/active_record/connection_adapters/pool_config.rb
         | 
| 131 | 
            +
            - lib/active_record/connection_adapters/pool_manager.rb
         | 
| 145 132 | 
             
            - lib/active_record/connection_adapters/postgresql/column.rb
         | 
| 146 133 | 
             
            - lib/active_record/connection_adapters/postgresql/database_statements.rb
         | 
| 147 134 | 
             
            - lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb
         | 
| @@ -157,8 +144,10 @@ files: | |
| 157 144 | 
             
            - lib/active_record/connection_adapters/postgresql/oid/enum.rb
         | 
| 158 145 | 
             
            - lib/active_record/connection_adapters/postgresql/oid/hstore.rb
         | 
| 159 146 | 
             
            - lib/active_record/connection_adapters/postgresql/oid/inet.rb
         | 
| 147 | 
            +
            - lib/active_record/connection_adapters/postgresql/oid/interval.rb
         | 
| 160 148 | 
             
            - lib/active_record/connection_adapters/postgresql/oid/jsonb.rb
         | 
| 161 149 | 
             
            - lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb
         | 
| 150 | 
            +
            - lib/active_record/connection_adapters/postgresql/oid/macaddr.rb
         | 
| 162 151 | 
             
            - lib/active_record/connection_adapters/postgresql/oid/money.rb
         | 
| 163 152 | 
             
            - lib/active_record/connection_adapters/postgresql/oid/oid.rb
         | 
| 164 153 | 
             
            - lib/active_record/connection_adapters/postgresql/oid/point.rb
         | 
| @@ -179,6 +168,7 @@ files: | |
| 179 168 | 
             
            - lib/active_record/connection_adapters/postgresql_adapter.rb
         | 
| 180 169 | 
             
            - lib/active_record/connection_adapters/schema_cache.rb
         | 
| 181 170 | 
             
            - lib/active_record/connection_adapters/sql_type_metadata.rb
         | 
| 171 | 
            +
            - lib/active_record/connection_adapters/sqlite3/database_statements.rb
         | 
| 182 172 | 
             
            - lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb
         | 
| 183 173 | 
             
            - lib/active_record/connection_adapters/sqlite3/quoting.rb
         | 
| 184 174 | 
             
            - lib/active_record/connection_adapters/sqlite3/schema_creation.rb
         | 
| @@ -190,7 +180,13 @@ files: | |
| 190 180 | 
             
            - lib/active_record/connection_handling.rb
         | 
| 191 181 | 
             
            - lib/active_record/core.rb
         | 
| 192 182 | 
             
            - lib/active_record/counter_cache.rb
         | 
| 193 | 
            -
            - lib/active_record/ | 
| 183 | 
            +
            - lib/active_record/database_configurations.rb
         | 
| 184 | 
            +
            - lib/active_record/database_configurations/connection_url_resolver.rb
         | 
| 185 | 
            +
            - lib/active_record/database_configurations/database_config.rb
         | 
| 186 | 
            +
            - lib/active_record/database_configurations/hash_config.rb
         | 
| 187 | 
            +
            - lib/active_record/database_configurations/url_config.rb
         | 
| 188 | 
            +
            - lib/active_record/delegated_type.rb
         | 
| 189 | 
            +
            - lib/active_record/destroy_association_async_job.rb
         | 
| 194 190 | 
             
            - lib/active_record/dynamic_matchers.rb
         | 
| 195 191 | 
             
            - lib/active_record/enum.rb
         | 
| 196 192 | 
             
            - lib/active_record/errors.rb
         | 
| @@ -198,9 +194,14 @@ files: | |
| 198 194 | 
             
            - lib/active_record/explain_registry.rb
         | 
| 199 195 | 
             
            - lib/active_record/explain_subscriber.rb
         | 
| 200 196 | 
             
            - lib/active_record/fixture_set/file.rb
         | 
| 197 | 
            +
            - lib/active_record/fixture_set/model_metadata.rb
         | 
| 198 | 
            +
            - lib/active_record/fixture_set/render_context.rb
         | 
| 199 | 
            +
            - lib/active_record/fixture_set/table_row.rb
         | 
| 200 | 
            +
            - lib/active_record/fixture_set/table_rows.rb
         | 
| 201 201 | 
             
            - lib/active_record/fixtures.rb
         | 
| 202 202 | 
             
            - lib/active_record/gem_version.rb
         | 
| 203 203 | 
             
            - lib/active_record/inheritance.rb
         | 
| 204 | 
            +
            - lib/active_record/insert_all.rb
         | 
| 204 205 | 
             
            - lib/active_record/integration.rb
         | 
| 205 206 | 
             
            - lib/active_record/internal_metadata.rb
         | 
| 206 207 | 
             
            - lib/active_record/legacy_yaml_adapter.rb
         | 
| @@ -208,6 +209,9 @@ files: | |
| 208 209 | 
             
            - lib/active_record/locking/optimistic.rb
         | 
| 209 210 | 
             
            - lib/active_record/locking/pessimistic.rb
         | 
| 210 211 | 
             
            - lib/active_record/log_subscriber.rb
         | 
| 212 | 
            +
            - lib/active_record/middleware/database_selector.rb
         | 
| 213 | 
            +
            - lib/active_record/middleware/database_selector/resolver.rb
         | 
| 214 | 
            +
            - lib/active_record/middleware/database_selector/resolver/session.rb
         | 
| 211 215 | 
             
            - lib/active_record/migration.rb
         | 
| 212 216 | 
             
            - lib/active_record/migration/command_recorder.rb
         | 
| 213 217 | 
             
            - lib/active_record/migration/compatibility.rb
         | 
| @@ -236,7 +240,6 @@ files: | |
| 236 240 | 
             
            - lib/active_record/relation/predicate_builder.rb
         | 
| 237 241 | 
             
            - lib/active_record/relation/predicate_builder/array_handler.rb
         | 
| 238 242 | 
             
            - lib/active_record/relation/predicate_builder/association_query_value.rb
         | 
| 239 | 
            -
            - lib/active_record/relation/predicate_builder/base_handler.rb
         | 
| 240 243 | 
             
            - lib/active_record/relation/predicate_builder/basic_object_handler.rb
         | 
| 241 244 | 
             
            - lib/active_record/relation/predicate_builder/polymorphic_array_value.rb
         | 
| 242 245 | 
             
            - lib/active_record/relation/predicate_builder/range_handler.rb
         | 
| @@ -246,7 +249,6 @@ files: | |
| 246 249 | 
             
            - lib/active_record/relation/record_fetch_warning.rb
         | 
| 247 250 | 
             
            - lib/active_record/relation/spawn_methods.rb
         | 
| 248 251 | 
             
            - lib/active_record/relation/where_clause.rb
         | 
| 249 | 
            -
            - lib/active_record/relation/where_clause_factory.rb
         | 
| 250 252 | 
             
            - lib/active_record/result.rb
         | 
| 251 253 | 
             
            - lib/active_record/runtime_registry.rb
         | 
| 252 254 | 
             
            - lib/active_record/sanitization.rb
         | 
| @@ -258,6 +260,7 @@ files: | |
| 258 260 | 
             
            - lib/active_record/scoping/named.rb
         | 
| 259 261 | 
             
            - lib/active_record/secure_token.rb
         | 
| 260 262 | 
             
            - lib/active_record/serialization.rb
         | 
| 263 | 
            +
            - lib/active_record/signed_id.rb
         | 
| 261 264 | 
             
            - lib/active_record/statement_cache.rb
         | 
| 262 265 | 
             
            - lib/active_record/store.rb
         | 
| 263 266 | 
             
            - lib/active_record/suppressor.rb
         | 
| @@ -266,6 +269,8 @@ files: | |
| 266 269 | 
             
            - lib/active_record/tasks/mysql_database_tasks.rb
         | 
| 267 270 | 
             
            - lib/active_record/tasks/postgresql_database_tasks.rb
         | 
| 268 271 | 
             
            - lib/active_record/tasks/sqlite_database_tasks.rb
         | 
| 272 | 
            +
            - lib/active_record/test_databases.rb
         | 
| 273 | 
            +
            - lib/active_record/test_fixtures.rb
         | 
| 269 274 | 
             
            - lib/active_record/timestamp.rb
         | 
| 270 275 | 
             
            - lib/active_record/touch_later.rb
         | 
| 271 276 | 
             
            - lib/active_record/transactions.rb
         | 
| @@ -290,9 +295,85 @@ files: | |
| 290 295 | 
             
            - lib/active_record/validations/absence.rb
         | 
| 291 296 | 
             
            - lib/active_record/validations/associated.rb
         | 
| 292 297 | 
             
            - lib/active_record/validations/length.rb
         | 
| 298 | 
            +
            - lib/active_record/validations/numericality.rb
         | 
| 293 299 | 
             
            - lib/active_record/validations/presence.rb
         | 
| 294 300 | 
             
            - lib/active_record/validations/uniqueness.rb
         | 
| 295 301 | 
             
            - lib/active_record/version.rb
         | 
| 302 | 
            +
            - lib/arel.rb
         | 
| 303 | 
            +
            - lib/arel/alias_predication.rb
         | 
| 304 | 
            +
            - lib/arel/attributes/attribute.rb
         | 
| 305 | 
            +
            - lib/arel/collectors/bind.rb
         | 
| 306 | 
            +
            - lib/arel/collectors/composite.rb
         | 
| 307 | 
            +
            - lib/arel/collectors/plain_string.rb
         | 
| 308 | 
            +
            - lib/arel/collectors/sql_string.rb
         | 
| 309 | 
            +
            - lib/arel/collectors/substitute_binds.rb
         | 
| 310 | 
            +
            - lib/arel/crud.rb
         | 
| 311 | 
            +
            - lib/arel/delete_manager.rb
         | 
| 312 | 
            +
            - lib/arel/errors.rb
         | 
| 313 | 
            +
            - lib/arel/expressions.rb
         | 
| 314 | 
            +
            - lib/arel/factory_methods.rb
         | 
| 315 | 
            +
            - lib/arel/insert_manager.rb
         | 
| 316 | 
            +
            - lib/arel/math.rb
         | 
| 317 | 
            +
            - lib/arel/nodes.rb
         | 
| 318 | 
            +
            - lib/arel/nodes/and.rb
         | 
| 319 | 
            +
            - lib/arel/nodes/ascending.rb
         | 
| 320 | 
            +
            - lib/arel/nodes/binary.rb
         | 
| 321 | 
            +
            - lib/arel/nodes/bind_param.rb
         | 
| 322 | 
            +
            - lib/arel/nodes/case.rb
         | 
| 323 | 
            +
            - lib/arel/nodes/casted.rb
         | 
| 324 | 
            +
            - lib/arel/nodes/comment.rb
         | 
| 325 | 
            +
            - lib/arel/nodes/count.rb
         | 
| 326 | 
            +
            - lib/arel/nodes/delete_statement.rb
         | 
| 327 | 
            +
            - lib/arel/nodes/descending.rb
         | 
| 328 | 
            +
            - lib/arel/nodes/equality.rb
         | 
| 329 | 
            +
            - lib/arel/nodes/extract.rb
         | 
| 330 | 
            +
            - lib/arel/nodes/false.rb
         | 
| 331 | 
            +
            - lib/arel/nodes/full_outer_join.rb
         | 
| 332 | 
            +
            - lib/arel/nodes/function.rb
         | 
| 333 | 
            +
            - lib/arel/nodes/grouping.rb
         | 
| 334 | 
            +
            - lib/arel/nodes/homogeneous_in.rb
         | 
| 335 | 
            +
            - lib/arel/nodes/in.rb
         | 
| 336 | 
            +
            - lib/arel/nodes/infix_operation.rb
         | 
| 337 | 
            +
            - lib/arel/nodes/inner_join.rb
         | 
| 338 | 
            +
            - lib/arel/nodes/insert_statement.rb
         | 
| 339 | 
            +
            - lib/arel/nodes/join_source.rb
         | 
| 340 | 
            +
            - lib/arel/nodes/matches.rb
         | 
| 341 | 
            +
            - lib/arel/nodes/named_function.rb
         | 
| 342 | 
            +
            - lib/arel/nodes/node.rb
         | 
| 343 | 
            +
            - lib/arel/nodes/node_expression.rb
         | 
| 344 | 
            +
            - lib/arel/nodes/ordering.rb
         | 
| 345 | 
            +
            - lib/arel/nodes/outer_join.rb
         | 
| 346 | 
            +
            - lib/arel/nodes/over.rb
         | 
| 347 | 
            +
            - lib/arel/nodes/regexp.rb
         | 
| 348 | 
            +
            - lib/arel/nodes/right_outer_join.rb
         | 
| 349 | 
            +
            - lib/arel/nodes/select_core.rb
         | 
| 350 | 
            +
            - lib/arel/nodes/select_statement.rb
         | 
| 351 | 
            +
            - lib/arel/nodes/sql_literal.rb
         | 
| 352 | 
            +
            - lib/arel/nodes/string_join.rb
         | 
| 353 | 
            +
            - lib/arel/nodes/table_alias.rb
         | 
| 354 | 
            +
            - lib/arel/nodes/terminal.rb
         | 
| 355 | 
            +
            - lib/arel/nodes/true.rb
         | 
| 356 | 
            +
            - lib/arel/nodes/unary.rb
         | 
| 357 | 
            +
            - lib/arel/nodes/unary_operation.rb
         | 
| 358 | 
            +
            - lib/arel/nodes/unqualified_column.rb
         | 
| 359 | 
            +
            - lib/arel/nodes/update_statement.rb
         | 
| 360 | 
            +
            - lib/arel/nodes/values_list.rb
         | 
| 361 | 
            +
            - lib/arel/nodes/window.rb
         | 
| 362 | 
            +
            - lib/arel/nodes/with.rb
         | 
| 363 | 
            +
            - lib/arel/order_predications.rb
         | 
| 364 | 
            +
            - lib/arel/predications.rb
         | 
| 365 | 
            +
            - lib/arel/select_manager.rb
         | 
| 366 | 
            +
            - lib/arel/table.rb
         | 
| 367 | 
            +
            - lib/arel/tree_manager.rb
         | 
| 368 | 
            +
            - lib/arel/update_manager.rb
         | 
| 369 | 
            +
            - lib/arel/visitors.rb
         | 
| 370 | 
            +
            - lib/arel/visitors/dot.rb
         | 
| 371 | 
            +
            - lib/arel/visitors/mysql.rb
         | 
| 372 | 
            +
            - lib/arel/visitors/postgresql.rb
         | 
| 373 | 
            +
            - lib/arel/visitors/sqlite.rb
         | 
| 374 | 
            +
            - lib/arel/visitors/to_sql.rb
         | 
| 375 | 
            +
            - lib/arel/visitors/visitor.rb
         | 
| 376 | 
            +
            - lib/arel/window_predications.rb
         | 
| 296 377 | 
             
            - lib/rails/generators/active_record.rb
         | 
| 297 378 | 
             
            - lib/rails/generators/active_record/application_record/application_record_generator.rb
         | 
| 298 379 | 
             
            - lib/rails/generators/active_record/application_record/templates/application_record.rb.tt
         | 
| @@ -301,14 +382,18 @@ files: | |
| 301 382 | 
             
            - lib/rails/generators/active_record/migration/templates/create_table_migration.rb.tt
         | 
| 302 383 | 
             
            - lib/rails/generators/active_record/migration/templates/migration.rb.tt
         | 
| 303 384 | 
             
            - lib/rails/generators/active_record/model/model_generator.rb
         | 
| 385 | 
            +
            - lib/rails/generators/active_record/model/templates/abstract_base_class.rb.tt
         | 
| 304 386 | 
             
            - lib/rails/generators/active_record/model/templates/model.rb.tt
         | 
| 305 387 | 
             
            - lib/rails/generators/active_record/model/templates/module.rb.tt
         | 
| 306 | 
            -
            homepage:  | 
| 388 | 
            +
            homepage: https://rubyonrails.org
         | 
| 307 389 | 
             
            licenses:
         | 
| 308 390 | 
             
            - MIT
         | 
| 309 391 | 
             
            metadata:
         | 
| 310 | 
            -
               | 
| 311 | 
            -
              changelog_uri: https://github.com/rails/rails/blob/ | 
| 392 | 
            +
              bug_tracker_uri: https://github.com/rails/rails/issues
         | 
| 393 | 
            +
              changelog_uri: https://github.com/rails/rails/blob/v6.1.0/activerecord/CHANGELOG.md
         | 
| 394 | 
            +
              documentation_uri: https://api.rubyonrails.org/v6.1.0/
         | 
| 395 | 
            +
              mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
         | 
| 396 | 
            +
              source_code_uri: https://github.com/rails/rails/tree/v6.1.0/activerecord
         | 
| 312 397 | 
             
            post_install_message: 
         | 
| 313 398 | 
             
            rdoc_options:
         | 
| 314 399 | 
             
            - "--main"
         | 
| @@ -319,14 +404,14 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 319 404 | 
             
              requirements:
         | 
| 320 405 | 
             
              - - ">="
         | 
| 321 406 | 
             
                - !ruby/object:Gem::Version
         | 
| 322 | 
            -
                  version: 2. | 
| 407 | 
            +
                  version: 2.5.0
         | 
| 323 408 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 324 409 | 
             
              requirements:
         | 
| 325 410 | 
             
              - - ">="
         | 
| 326 411 | 
             
                - !ruby/object:Gem::Version
         | 
| 327 412 | 
             
                  version: '0'
         | 
| 328 413 | 
             
            requirements: []
         | 
| 329 | 
            -
            rubygems_version: 3. | 
| 414 | 
            +
            rubygems_version: 3.1.4
         | 
| 330 415 | 
             
            signing_key: 
         | 
| 331 416 | 
             
            specification_version: 4
         | 
| 332 417 | 
             
            summary: Object-relational mapper framework (part of Rails).
         |