activerecord 6.0.2.2 → 6.0.3.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activerecord might be problematic. Click here for more details.

Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +66 -0
  3. data/README.rdoc +1 -1
  4. data/lib/active_record.rb +1 -0
  5. data/lib/active_record/advisory_lock_base.rb +18 -0
  6. data/lib/active_record/aggregations.rb +0 -1
  7. data/lib/active_record/association_relation.rb +4 -11
  8. data/lib/active_record/associations.rb +1 -1
  9. data/lib/active_record/associations/alias_tracker.rb +0 -1
  10. data/lib/active_record/associations/association.rb +5 -9
  11. data/lib/active_record/associations/builder/has_and_belongs_to_many.rb +0 -2
  12. data/lib/active_record/associations/collection_proxy.rb +1 -2
  13. data/lib/active_record/associations/has_many_association.rb +0 -1
  14. data/lib/active_record/associations/join_dependency.rb +9 -0
  15. data/lib/active_record/associations/preloader.rb +0 -1
  16. data/lib/active_record/attribute_assignment.rb +0 -1
  17. data/lib/active_record/attribute_decorators.rb +0 -2
  18. data/lib/active_record/attribute_methods/before_type_cast.rb +0 -1
  19. data/lib/active_record/attribute_methods/dirty.rb +2 -2
  20. data/lib/active_record/attribute_methods/primary_key.rb +0 -2
  21. data/lib/active_record/attribute_methods/read.rb +0 -1
  22. data/lib/active_record/attribute_methods/serialization.rb +0 -1
  23. data/lib/active_record/attribute_methods/time_zone_conversion.rb +0 -2
  24. data/lib/active_record/attribute_methods/write.rb +0 -1
  25. data/lib/active_record/attributes.rb +0 -1
  26. data/lib/active_record/autosave_association.rb +3 -3
  27. data/lib/active_record/callbacks.rb +1 -2
  28. data/lib/active_record/coders/yaml_column.rb +0 -1
  29. data/lib/active_record/connection_adapters/abstract/connection_pool.rb +0 -3
  30. data/lib/active_record/connection_adapters/abstract/database_statements.rb +17 -15
  31. data/lib/active_record/connection_adapters/abstract/query_cache.rb +0 -1
  32. data/lib/active_record/connection_adapters/abstract/schema_creation.rb +1 -2
  33. data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +27 -27
  34. data/lib/active_record/connection_adapters/abstract/schema_statements.rb +47 -30
  35. data/lib/active_record/connection_adapters/abstract/transaction.rb +4 -5
  36. data/lib/active_record/connection_adapters/abstract_adapter.rb +7 -3
  37. data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +12 -28
  38. data/lib/active_record/connection_adapters/connection_specification.rb +1 -2
  39. data/lib/active_record/connection_adapters/mysql/column.rb +1 -1
  40. data/lib/active_record/connection_adapters/mysql/database_statements.rb +5 -11
  41. data/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb +0 -1
  42. data/lib/active_record/connection_adapters/mysql/schema_creation.rb +1 -2
  43. data/lib/active_record/connection_adapters/mysql/schema_statements.rb +8 -8
  44. data/lib/active_record/connection_adapters/mysql2_adapter.rb +0 -1
  45. data/lib/active_record/connection_adapters/postgresql/database_statements.rb +6 -2
  46. data/lib/active_record/connection_adapters/postgresql/oid/array.rb +0 -1
  47. data/lib/active_record/connection_adapters/postgresql/oid/enum.rb +0 -1
  48. data/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +0 -1
  49. data/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb +0 -1
  50. data/lib/active_record/connection_adapters/postgresql/oid/oid.rb +1 -1
  51. data/lib/active_record/connection_adapters/postgresql/oid/point.rb +0 -1
  52. data/lib/active_record/connection_adapters/postgresql/oid/range.rb +0 -1
  53. data/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb +1 -1
  54. data/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +0 -1
  55. data/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +1 -1
  56. data/lib/active_record/connection_adapters/postgresql/schema_creation.rb +2 -2
  57. data/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +1 -1
  58. data/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +0 -1
  59. data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +15 -29
  60. data/lib/active_record/connection_adapters/postgresql/utils.rb +0 -1
  61. data/lib/active_record/connection_adapters/postgresql_adapter.rb +5 -2
  62. data/lib/active_record/connection_adapters/sqlite3/database_statements.rb +5 -6
  63. data/lib/active_record/connection_adapters/sqlite3/quoting.rb +0 -1
  64. data/lib/active_record/connection_adapters/sqlite3/schema_statements.rb +3 -3
  65. data/lib/active_record/connection_adapters/sqlite3_adapter.rb +8 -7
  66. data/lib/active_record/connection_adapters/statement_pool.rb +0 -1
  67. data/lib/active_record/connection_handling.rb +10 -26
  68. data/lib/active_record/core.rb +0 -2
  69. data/lib/active_record/counter_cache.rb +4 -1
  70. data/lib/active_record/database_configurations/url_config.rb +0 -1
  71. data/lib/active_record/dynamic_matchers.rb +2 -3
  72. data/lib/active_record/explain.rb +0 -1
  73. data/lib/active_record/fixture_set/table_row.rb +0 -1
  74. data/lib/active_record/fixture_set/table_rows.rb +0 -1
  75. data/lib/active_record/fixtures.rb +0 -3
  76. data/lib/active_record/gem_version.rb +2 -2
  77. data/lib/active_record/inheritance.rb +0 -3
  78. data/lib/active_record/insert_all.rb +3 -3
  79. data/lib/active_record/internal_metadata.rb +1 -1
  80. data/lib/active_record/locking/optimistic.rb +0 -1
  81. data/lib/active_record/log_subscriber.rb +1 -1
  82. data/lib/active_record/middleware/database_selector.rb +0 -1
  83. data/lib/active_record/middleware/database_selector/resolver.rb +1 -2
  84. data/lib/active_record/migration.rb +4 -4
  85. data/lib/active_record/migration/command_recorder.rb +6 -18
  86. data/lib/active_record/migration/compatibility.rb +3 -3
  87. data/lib/active_record/migration/join_table.rb +0 -1
  88. data/lib/active_record/model_schema.rb +0 -2
  89. data/lib/active_record/nested_attributes.rb +0 -2
  90. data/lib/active_record/no_touching.rb +2 -2
  91. data/lib/active_record/null_relation.rb +0 -1
  92. data/lib/active_record/persistence.rb +4 -5
  93. data/lib/active_record/querying.rb +1 -1
  94. data/lib/active_record/railtie.rb +1 -1
  95. data/lib/active_record/railties/collection_cache_association_loading.rb +1 -1
  96. data/lib/active_record/reflection.rb +8 -8
  97. data/lib/active_record/relation.rb +12 -1
  98. data/lib/active_record/relation/batches.rb +0 -1
  99. data/lib/active_record/relation/calculations.rb +1 -1
  100. data/lib/active_record/relation/delegation.rb +7 -6
  101. data/lib/active_record/relation/finder_methods.rb +0 -1
  102. data/lib/active_record/relation/from_clause.rb +4 -0
  103. data/lib/active_record/relation/merger.rb +0 -1
  104. data/lib/active_record/relation/predicate_builder.rb +1 -5
  105. data/lib/active_record/relation/query_methods.rb +9 -7
  106. data/lib/active_record/relation/spawn_methods.rb +0 -1
  107. data/lib/active_record/relation/where_clause.rb +0 -1
  108. data/lib/active_record/result.rb +0 -1
  109. data/lib/active_record/schema_migration.rb +1 -1
  110. data/lib/active_record/scoping.rb +0 -1
  111. data/lib/active_record/scoping/default.rb +0 -1
  112. data/lib/active_record/scoping/named.rb +3 -4
  113. data/lib/active_record/store.rb +1 -1
  114. data/lib/active_record/suppressor.rb +2 -2
  115. data/lib/active_record/table_metadata.rb +16 -1
  116. data/lib/active_record/tasks/mysql_database_tasks.rb +0 -1
  117. data/lib/active_record/tasks/postgresql_database_tasks.rb +0 -1
  118. data/lib/active_record/tasks/sqlite_database_tasks.rb +0 -1
  119. data/lib/active_record/test_fixtures.rb +1 -1
  120. data/lib/active_record/timestamp.rb +0 -1
  121. data/lib/active_record/touch_later.rb +1 -2
  122. data/lib/active_record/transactions.rb +8 -8
  123. data/lib/active_record/type.rb +0 -1
  124. data/lib/active_record/type/adapter_specific_registry.rb +2 -5
  125. data/lib/active_record/type/hash_lookup_type_map.rb +0 -1
  126. data/lib/active_record/type/serialized.rb +0 -1
  127. data/lib/active_record/type/type_map.rb +0 -1
  128. data/lib/active_record/type/unsigned_integer.rb +0 -1
  129. data/lib/active_record/validations.rb +2 -3
  130. data/lib/active_record/validations/associated.rb +1 -2
  131. data/lib/arel.rb +5 -1
  132. data/lib/arel/predications.rb +5 -6
  133. data/lib/arel/visitors/depth_first.rb +0 -1
  134. data/lib/arel/visitors/dot.rb +0 -1
  135. data/lib/arel/visitors/mssql.rb +0 -1
  136. data/lib/arel/visitors/oracle.rb +1 -2
  137. data/lib/arel/visitors/oracle12.rb +0 -1
  138. data/lib/arel/visitors/postgresql.rb +0 -1
  139. data/lib/arel/visitors/sqlite.rb +0 -1
  140. data/lib/arel/visitors/to_sql.rb +0 -1
  141. data/lib/arel/visitors/visitor.rb +0 -1
  142. data/lib/arel/visitors/where_sql.rb +0 -1
  143. data/lib/rails/generators/active_record/application_record/application_record_generator.rb +0 -1
  144. data/lib/rails/generators/active_record/migration.rb +0 -1
  145. data/lib/rails/generators/active_record/migration/templates/migration.rb.tt +1 -1
  146. data/lib/rails/generators/active_record/model/model_generator.rb +0 -1
  147. metadata +14 -13
@@ -98,7 +98,7 @@ module ActiveRecord
98
98
  end
99
99
 
100
100
  def rollback_records
101
- ite = records.uniq(&:object_id)
101
+ ite = records.uniq(&:__id__)
102
102
  already_run_callbacks = {}
103
103
  while record = ite.shift
104
104
  trigger_callbacks = record.trigger_transactional_callbacks?
@@ -117,7 +117,7 @@ module ActiveRecord
117
117
  end
118
118
 
119
119
  def commit_records
120
- ite = records.uniq(&:object_id)
120
+ ite = records.uniq(&:__id__)
121
121
  already_run_callbacks = {}
122
122
  while record = ite.shift
123
123
  if @run_commit_callbacks
@@ -141,8 +141,8 @@ module ActiveRecord
141
141
  end
142
142
 
143
143
  class SavepointTransaction < Transaction
144
- def initialize(connection, savepoint_name, parent_transaction, *args)
145
- super(connection, *args)
144
+ def initialize(connection, savepoint_name, parent_transaction, *args, **options)
145
+ super(connection, *args, **options)
146
146
 
147
147
  parent_transaction.state.add_child(@state)
148
148
 
@@ -309,7 +309,6 @@ module ActiveRecord
309
309
  end
310
310
 
311
311
  private
312
-
313
312
  NULL_TRANSACTION = NullTransaction.new
314
313
 
315
314
  # Deallocate invalidated prepared statements outside of the transaction
@@ -77,6 +77,7 @@ module ActiveRecord
77
77
  include Savepoints
78
78
 
79
79
  SIMPLE_INT = /\A\d+\z/
80
+ COMMENT_REGEX = %r{/\*(?:[^\*]|\*[^/])*\*/}m
80
81
 
81
82
  attr_accessor :pool
82
83
  attr_reader :visitor, :owner, :logger, :lock
@@ -103,8 +104,8 @@ module ActiveRecord
103
104
  end
104
105
 
105
106
  def self.build_read_query_regexp(*parts) # :nodoc:
106
- parts = parts.map { |part| /\A[\(\s]*#{part}/i }
107
- Regexp.union(*parts)
107
+ parts = parts.map { |part| /#{part}/i }
108
+ /\A(?:[\(\s]|#{COMMENT_REGEX})*#{Regexp.union(*parts)}/
108
109
  end
109
110
 
110
111
  def self.quoted_column_names # :nodoc:
@@ -312,6 +313,10 @@ module ActiveRecord
312
313
  false
313
314
  end
314
315
 
316
+ def supports_partitioned_indexes?
317
+ false
318
+ end
319
+
315
320
  # Does this adapter support index sort order?
316
321
  def supports_index_sort_order?
317
322
  false
@@ -620,7 +625,6 @@ module ActiveRecord
620
625
  end
621
626
 
622
627
  private
623
-
624
628
  def type_map
625
629
  @type_map ||= Type::TypeMap.new.tap do |mapping|
626
630
  initialize_type_map(mapping)
@@ -45,7 +45,6 @@ module ActiveRecord
45
45
 
46
46
  class StatementPool < ConnectionAdapters::StatementPool # :nodoc:
47
47
  private
48
-
49
48
  def dealloc(stmt)
50
49
  stmt.close
51
50
  end
@@ -367,7 +366,7 @@ module ActiveRecord
367
366
  end
368
367
 
369
368
  def add_index(table_name, column_name, options = {}) #:nodoc:
370
- index_name, index_type, index_columns, _, index_algorithm, index_using, comment = add_index_options(table_name, column_name, options)
369
+ index_name, index_type, index_columns, _, index_algorithm, index_using, comment = add_index_options(table_name, column_name, **options)
371
370
  sql = +"CREATE #{index_type} INDEX #{quote_column_name(index_name)} #{index_using} ON #{quote_table_name(table_name)} (#{index_columns}) #{index_algorithm}"
372
371
  execute add_sql_comment!(sql, comment)
373
372
  end
@@ -419,12 +418,13 @@ module ActiveRecord
419
418
  create_table_info = create_table_info(table_name)
420
419
 
421
420
  # strip create_definitions and partition_options
422
- raw_table_options = create_table_info.sub(/\A.*\n\) /m, "").sub(/\n\/\*!.*\*\/\n\z/m, "").strip
421
+ # Be aware that `create_table_info` might not include any table options due to `NO_TABLE_OPTIONS` sql mode.
422
+ raw_table_options = create_table_info.sub(/\A.*\n\) ?/m, "").sub(/\n\/\*!.*\*\/\n\z/m, "").strip
423
423
 
424
424
  # strip AUTO_INCREMENT
425
425
  raw_table_options.sub!(/(ENGINE=\w+)(?: AUTO_INCREMENT=\d+)/, '\1')
426
426
 
427
- table_options[:options] = raw_table_options
427
+ table_options[:options] = raw_table_options unless raw_table_options.blank?
428
428
 
429
429
  # strip COMMENT
430
430
  if raw_table_options.sub!(/ COMMENT='.+'/, "")
@@ -493,7 +493,7 @@ module ActiveRecord
493
493
  def columns_for_distinct(columns, orders) # :nodoc:
494
494
  order_columns = orders.reject(&:blank?).map { |s|
495
495
  # Convert Arel node to string
496
- s = s.to_sql unless s.is_a?(String)
496
+ s = visitor.compile(s) unless s.is_a?(String)
497
497
  # Remove any ASC/DESC modifiers
498
498
  s.gsub(/\s+(?:ASC|DESC)\b/i, "")
499
499
  }.reject(&:blank?).map.with_index { |column, i| "#{column} AS alias_#{i}" }
@@ -530,7 +530,6 @@ module ActiveRecord
530
530
  end
531
531
 
532
532
  private
533
-
534
533
  def initialize_type_map(m = type_map)
535
534
  super
536
535
 
@@ -570,12 +569,12 @@ module ActiveRecord
570
569
  end
571
570
  end
572
571
 
573
- def register_integer_type(mapping, key, options)
572
+ def register_integer_type(mapping, key, **options)
574
573
  mapping.register_type(key) do |sql_type|
575
574
  if /\bunsigned\b/.match?(sql_type)
576
- Type::UnsignedInteger.new(options)
575
+ Type::UnsignedInteger.new(**options)
577
576
  else
578
- Type::Integer.new(options)
577
+ Type::Integer.new(**options)
579
578
  end
580
579
  end
581
580
  end
@@ -657,7 +656,7 @@ module ActiveRecord
657
656
  end
658
657
 
659
658
  td = create_table_definition(table_name)
660
- cd = td.new_column_definition(column.name, type, options)
659
+ cd = td.new_column_definition(column.name, type, **options)
661
660
  schema_creation.accept(ChangeColumnDefinition.new(cd, column.name))
662
661
  end
663
662
 
@@ -671,12 +670,12 @@ module ActiveRecord
671
670
 
672
671
  current_type = exec_query("SHOW COLUMNS FROM #{quote_table_name(table_name)} LIKE #{quote(column_name)}", "SCHEMA").first["Type"]
673
672
  td = create_table_definition(table_name)
674
- cd = td.new_column_definition(new_column_name, current_type, options)
673
+ cd = td.new_column_definition(new_column_name, current_type, **options)
675
674
  schema_creation.accept(ChangeColumnDefinition.new(cd, column.name))
676
675
  end
677
676
 
678
677
  def add_index_for_alter(table_name, column_name, options = {})
679
- index_name, index_type, index_columns, _, index_algorithm, index_using = add_index_options(table_name, column_name, options)
678
+ index_name, index_type, index_columns, _, index_algorithm, index_using = add_index_options(table_name, column_name, **options)
680
679
  index_algorithm[0, 0] = ", " if index_algorithm.present?
681
680
  "ADD #{index_type} INDEX #{quote_column_name(index_name)} #{index_using} (#{index_columns})#{index_algorithm}"
682
681
  end
@@ -686,20 +685,6 @@ module ActiveRecord
686
685
  "DROP INDEX #{quote_column_name(index_name)}"
687
686
  end
688
687
 
689
- def add_timestamps_for_alter(table_name, options = {})
690
- options[:null] = false if options[:null].nil?
691
-
692
- if !options.key?(:precision) && supports_datetime_with_precision?
693
- options[:precision] = 6
694
- end
695
-
696
- [add_column_for_alter(table_name, :created_at, :datetime, options), add_column_for_alter(table_name, :updated_at, :datetime, options)]
697
- end
698
-
699
- def remove_timestamps_for_alter(table_name, options = {})
700
- [remove_column_for_alter(table_name, :updated_at), remove_column_for_alter(table_name, :created_at)]
701
- end
702
-
703
688
  def supports_rename_index?
704
689
  mariadb? ? false : database_version >= "5.7.6"
705
690
  end
@@ -796,7 +781,7 @@ module ActiveRecord
796
781
  options[:primary_key_column] = column_for(match[:target_table], match[:primary_key])
797
782
  end
798
783
 
799
- MismatchedForeignKey.new(options)
784
+ MismatchedForeignKey.new(**options)
800
785
  end
801
786
 
802
787
  def version_string(full_version_string)
@@ -813,7 +798,6 @@ module ActiveRecord
813
798
  end
814
799
 
815
800
  private
816
-
817
801
  def cast_value(value)
818
802
  case value
819
803
  when true then "1"
@@ -56,7 +56,6 @@ module ActiveRecord
56
56
  end
57
57
 
58
58
  private
59
-
60
59
  attr_reader :uri
61
60
 
62
61
  def uri_parser
@@ -73,7 +72,7 @@ module ActiveRecord
73
72
  # "localhost"
74
73
  # # => {}
75
74
  def query_hash
76
- Hash[(@query || "").split("&").map { |pair| pair.split("=") }]
75
+ Hash[(@query || "").split("&").map { |pair| pair.split("=", 2) }]
77
76
  end
78
77
 
79
78
  def raw_config
@@ -11,7 +11,7 @@ module ActiveRecord
11
11
  end
12
12
 
13
13
  def case_sensitive?
14
- collation && !/_ci\z/.match?(collation)
14
+ collation && !collation.end_with?("_ci")
15
15
  end
16
16
 
17
17
  def auto_increment?
@@ -5,7 +5,7 @@ module ActiveRecord
5
5
  module MySQL
6
6
  module DatabaseStatements
7
7
  # Returns an ActiveRecord::Result instance.
8
- def select_all(*) # :nodoc:
8
+ def select_all(*, **) # :nodoc:
9
9
  result = if ExplainRegistry.collect? && prepared_statements
10
10
  unprepared_statement { super }
11
11
  else
@@ -73,8 +73,10 @@ module ActiveRecord
73
73
  alias :exec_update :exec_delete
74
74
 
75
75
  private
76
- def execute_batch(sql, name = nil)
77
- super
76
+ def execute_batch(statements, name = nil)
77
+ combine_multi_statements(statements).each do |statement|
78
+ execute(statement, name)
79
+ end
78
80
  @connection.abandon_results!
79
81
  end
80
82
 
@@ -90,14 +92,6 @@ module ActiveRecord
90
92
  @connection.respond_to?(:set_server_option)
91
93
  end
92
94
 
93
- def build_truncate_statements(*table_names)
94
- if table_names.size == 1
95
- super.first
96
- else
97
- super
98
- end
99
- end
100
-
101
95
  def multi_statements_enabled?(flags)
102
96
  if flags.is_a?(Array)
103
97
  flags.include?("MULTI_STATEMENTS")
@@ -37,7 +37,6 @@ module ActiveRecord
37
37
  end
38
38
 
39
39
  private
40
-
41
40
  def compute_column_widths(result)
42
41
  [].tap do |widths|
43
42
  result.columns.each_with_index do |column, i|
@@ -7,7 +7,6 @@ module ActiveRecord
7
7
  delegate :add_sql_comment!, :mariadb?, to: :@conn, private: true
8
8
 
9
9
  private
10
-
11
10
  def visit_DropForeignKey(name)
12
11
  "DROP FOREIGN KEY #{name}"
13
12
  end
@@ -63,7 +62,7 @@ module ActiveRecord
63
62
  end
64
63
 
65
64
  def index_in_create(table_name, column_name, options)
66
- index_name, index_type, index_columns, _, _, index_using, comment = @conn.add_index_options(table_name, column_name, options)
65
+ index_name, index_type, index_columns, _, _, index_using, comment = @conn.add_index_options(table_name, column_name, **options)
67
66
  add_sql_comment!((+"#{index_type} INDEX #{quote_column_name(index_name)} #{index_using} (#{index_columns})"), comment)
68
67
  end
69
68
  end
@@ -51,26 +51,26 @@ module ActiveRecord
51
51
  end
52
52
 
53
53
  indexes.map do |index|
54
- options = index.last
54
+ options = index.pop
55
55
 
56
56
  if expressions = options.delete(:expressions)
57
57
  orders = options.delete(:orders)
58
58
  lengths = options.delete(:lengths)
59
59
 
60
- columns = index[-2].map { |name|
60
+ columns = index[-1].map { |name|
61
61
  [ name.to_sym, expressions[name] || +quote_column_name(name) ]
62
62
  }.to_h
63
63
 
64
- index[-2] = add_options_for_index_columns(
64
+ index[-1] = add_options_for_index_columns(
65
65
  columns, order: orders, length: lengths
66
66
  ).values.join(", ")
67
67
  end
68
68
 
69
- IndexDefinition.new(*index)
69
+ IndexDefinition.new(*index, **options)
70
70
  end
71
71
  end
72
72
 
73
- def remove_column(table_name, column_name, type = nil, options = {})
73
+ def remove_column(table_name, column_name, type = nil, **options)
74
74
  if foreign_key_exists?(table_name, column: column_name)
75
75
  remove_foreign_key(table_name, column: column_name)
76
76
  end
@@ -154,8 +154,8 @@ module ActiveRecord
154
154
  MySQL::SchemaCreation.new(self)
155
155
  end
156
156
 
157
- def create_table_definition(*args)
158
- MySQL::TableDefinition.new(self, *args)
157
+ def create_table_definition(*args, **options)
158
+ MySQL::TableDefinition.new(self, *args, **options)
159
159
  end
160
160
 
161
161
  def new_column_from_field(table_name, field)
@@ -196,7 +196,7 @@ module ActiveRecord
196
196
  end
197
197
 
198
198
  def add_options_for_index_columns(quoted_columns, **options)
199
- quoted_columns = add_index_length(quoted_columns, options)
199
+ quoted_columns = add_index_length(quoted_columns, **options)
200
200
  super
201
201
  end
202
202
 
@@ -123,7 +123,6 @@ module ActiveRecord
123
123
  end
124
124
 
125
125
  private
126
-
127
126
  def connect
128
127
  @connection = Mysql2::Client.new(@config)
129
128
  configure_connection
@@ -166,8 +166,12 @@ module ActiveRecord
166
166
  end
167
167
 
168
168
  private
169
- def build_truncate_statements(*table_names)
170
- "TRUNCATE TABLE #{table_names.map(&method(:quote_table_name)).join(", ")}"
169
+ def execute_batch(statements, name = nil)
170
+ execute(combine_multi_statements(statements))
171
+ end
172
+
173
+ def build_truncate_statements(table_names)
174
+ ["TRUNCATE TABLE #{table_names.map(&method(:quote_table_name)).join(", ")}"]
171
175
  end
172
176
 
173
177
  # Returns the current ID of a table's sequence.
@@ -77,7 +77,6 @@ module ActiveRecord
77
77
  end
78
78
 
79
79
  private
80
-
81
80
  def type_cast_array(value, method)
82
81
  if value.is_a?(::Array)
83
82
  value.map { |item| type_cast_array(item, method) }
@@ -10,7 +10,6 @@ module ActiveRecord
10
10
  end
11
11
 
12
12
  private
13
-
14
13
  def cast_value(value)
15
14
  value.to_s
16
15
  end
@@ -46,7 +46,6 @@ module ActiveRecord
46
46
  end
47
47
 
48
48
  private
49
-
50
49
  HstorePair = begin
51
50
  quoted_string = /"[^"\\]*(?:\\.[^"\\]*)*"/
52
51
  unquoted_string = /(?:\\.|[^\s,])[^\s=,\\]*(?:\\.[^\s=,\\]*|=[^,>])*/
@@ -34,7 +34,6 @@ module ActiveRecord
34
34
  end
35
35
 
36
36
  private
37
-
38
37
  def number_for_point(number)
39
38
  number.to_s.gsub(/\.0$/, "")
40
39
  end
@@ -4,7 +4,7 @@ module ActiveRecord
4
4
  module ConnectionAdapters
5
5
  module PostgreSQL
6
6
  module OID # :nodoc:
7
- class Oid < Type::Integer # :nodoc:
7
+ class Oid < Type::UnsignedInteger # :nodoc:
8
8
  def type
9
9
  :oid
10
10
  end
@@ -50,7 +50,6 @@ module ActiveRecord
50
50
  end
51
51
 
52
52
  private
53
-
54
53
  def number_for_point(number)
55
54
  number.to_s.gsub(/\.0$/, "")
56
55
  end
@@ -58,7 +58,6 @@ module ActiveRecord
58
58
  end
59
59
 
60
60
  private
61
-
62
61
  def type_cast_single(value)
63
62
  infinity?(value) ? value : @subtype.deserialize(value)
64
63
  end
@@ -9,7 +9,7 @@ module ActiveRecord
9
9
 
10
10
  def initialize(type, **options)
11
11
  @type = type
12
- super(options)
12
+ super(**options)
13
13
  end
14
14
  end
15
15
  end
@@ -14,7 +14,6 @@ module ActiveRecord
14
14
  end
15
15
 
16
16
  private
17
-
18
17
  def cast_value(value)
19
18
  casted = value.to_s
20
19
  casted if casted.match?(ACCEPTABLE_UUID)
@@ -26,7 +26,7 @@ Rails needs superuser privileges to disable referential integrity.
26
26
 
27
27
  cause: #{original_exception.try(:message)}
28
28
 
29
- WARNING
29
+ WARNING
30
30
  raise e
31
31
  end
32
32