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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +66 -0
- data/README.rdoc +1 -1
- data/lib/active_record.rb +1 -0
- data/lib/active_record/advisory_lock_base.rb +18 -0
- data/lib/active_record/aggregations.rb +0 -1
- data/lib/active_record/association_relation.rb +4 -11
- data/lib/active_record/associations.rb +1 -1
- data/lib/active_record/associations/alias_tracker.rb +0 -1
- data/lib/active_record/associations/association.rb +5 -9
- data/lib/active_record/associations/builder/has_and_belongs_to_many.rb +0 -2
- data/lib/active_record/associations/collection_proxy.rb +1 -2
- data/lib/active_record/associations/has_many_association.rb +0 -1
- data/lib/active_record/associations/join_dependency.rb +9 -0
- data/lib/active_record/associations/preloader.rb +0 -1
- data/lib/active_record/attribute_assignment.rb +0 -1
- data/lib/active_record/attribute_decorators.rb +0 -2
- data/lib/active_record/attribute_methods/before_type_cast.rb +0 -1
- data/lib/active_record/attribute_methods/dirty.rb +2 -2
- data/lib/active_record/attribute_methods/primary_key.rb +0 -2
- data/lib/active_record/attribute_methods/read.rb +0 -1
- data/lib/active_record/attribute_methods/serialization.rb +0 -1
- data/lib/active_record/attribute_methods/time_zone_conversion.rb +0 -2
- data/lib/active_record/attribute_methods/write.rb +0 -1
- data/lib/active_record/attributes.rb +0 -1
- data/lib/active_record/autosave_association.rb +3 -3
- data/lib/active_record/callbacks.rb +1 -2
- data/lib/active_record/coders/yaml_column.rb +0 -1
- data/lib/active_record/connection_adapters/abstract/connection_pool.rb +0 -3
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +17 -15
- data/lib/active_record/connection_adapters/abstract/query_cache.rb +0 -1
- data/lib/active_record/connection_adapters/abstract/schema_creation.rb +1 -2
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +27 -27
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +47 -30
- data/lib/active_record/connection_adapters/abstract/transaction.rb +4 -5
- data/lib/active_record/connection_adapters/abstract_adapter.rb +7 -3
- data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +12 -28
- data/lib/active_record/connection_adapters/connection_specification.rb +1 -2
- data/lib/active_record/connection_adapters/mysql/column.rb +1 -1
- data/lib/active_record/connection_adapters/mysql/database_statements.rb +5 -11
- data/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb +0 -1
- data/lib/active_record/connection_adapters/mysql/schema_creation.rb +1 -2
- data/lib/active_record/connection_adapters/mysql/schema_statements.rb +8 -8
- data/lib/active_record/connection_adapters/mysql2_adapter.rb +0 -1
- data/lib/active_record/connection_adapters/postgresql/database_statements.rb +6 -2
- data/lib/active_record/connection_adapters/postgresql/oid/array.rb +0 -1
- data/lib/active_record/connection_adapters/postgresql/oid/enum.rb +0 -1
- data/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +0 -1
- data/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb +0 -1
- data/lib/active_record/connection_adapters/postgresql/oid/oid.rb +1 -1
- data/lib/active_record/connection_adapters/postgresql/oid/point.rb +0 -1
- data/lib/active_record/connection_adapters/postgresql/oid/range.rb +0 -1
- data/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb +1 -1
- data/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +0 -1
- data/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +1 -1
- data/lib/active_record/connection_adapters/postgresql/schema_creation.rb +2 -2
- data/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +1 -1
- data/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +0 -1
- data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +15 -29
- data/lib/active_record/connection_adapters/postgresql/utils.rb +0 -1
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +5 -2
- data/lib/active_record/connection_adapters/sqlite3/database_statements.rb +5 -6
- data/lib/active_record/connection_adapters/sqlite3/quoting.rb +0 -1
- data/lib/active_record/connection_adapters/sqlite3/schema_statements.rb +3 -3
- data/lib/active_record/connection_adapters/sqlite3_adapter.rb +8 -7
- data/lib/active_record/connection_adapters/statement_pool.rb +0 -1
- data/lib/active_record/connection_handling.rb +10 -26
- data/lib/active_record/core.rb +0 -2
- data/lib/active_record/counter_cache.rb +4 -1
- data/lib/active_record/database_configurations/url_config.rb +0 -1
- data/lib/active_record/dynamic_matchers.rb +2 -3
- data/lib/active_record/explain.rb +0 -1
- data/lib/active_record/fixture_set/table_row.rb +0 -1
- data/lib/active_record/fixture_set/table_rows.rb +0 -1
- data/lib/active_record/fixtures.rb +0 -3
- data/lib/active_record/gem_version.rb +2 -2
- data/lib/active_record/inheritance.rb +0 -3
- data/lib/active_record/insert_all.rb +3 -3
- data/lib/active_record/internal_metadata.rb +1 -1
- data/lib/active_record/locking/optimistic.rb +0 -1
- data/lib/active_record/log_subscriber.rb +1 -1
- data/lib/active_record/middleware/database_selector.rb +0 -1
- data/lib/active_record/middleware/database_selector/resolver.rb +1 -2
- data/lib/active_record/migration.rb +4 -4
- data/lib/active_record/migration/command_recorder.rb +6 -18
- data/lib/active_record/migration/compatibility.rb +3 -3
- data/lib/active_record/migration/join_table.rb +0 -1
- data/lib/active_record/model_schema.rb +0 -2
- data/lib/active_record/nested_attributes.rb +0 -2
- data/lib/active_record/no_touching.rb +2 -2
- data/lib/active_record/null_relation.rb +0 -1
- data/lib/active_record/persistence.rb +4 -5
- data/lib/active_record/querying.rb +1 -1
- data/lib/active_record/railtie.rb +1 -1
- data/lib/active_record/railties/collection_cache_association_loading.rb +1 -1
- data/lib/active_record/reflection.rb +8 -8
- data/lib/active_record/relation.rb +12 -1
- data/lib/active_record/relation/batches.rb +0 -1
- data/lib/active_record/relation/calculations.rb +1 -1
- data/lib/active_record/relation/delegation.rb +7 -6
- data/lib/active_record/relation/finder_methods.rb +0 -1
- data/lib/active_record/relation/from_clause.rb +4 -0
- data/lib/active_record/relation/merger.rb +0 -1
- data/lib/active_record/relation/predicate_builder.rb +1 -5
- data/lib/active_record/relation/query_methods.rb +9 -7
- data/lib/active_record/relation/spawn_methods.rb +0 -1
- data/lib/active_record/relation/where_clause.rb +0 -1
- data/lib/active_record/result.rb +0 -1
- data/lib/active_record/schema_migration.rb +1 -1
- data/lib/active_record/scoping.rb +0 -1
- data/lib/active_record/scoping/default.rb +0 -1
- data/lib/active_record/scoping/named.rb +3 -4
- data/lib/active_record/store.rb +1 -1
- data/lib/active_record/suppressor.rb +2 -2
- data/lib/active_record/table_metadata.rb +16 -1
- data/lib/active_record/tasks/mysql_database_tasks.rb +0 -1
- data/lib/active_record/tasks/postgresql_database_tasks.rb +0 -1
- data/lib/active_record/tasks/sqlite_database_tasks.rb +0 -1
- data/lib/active_record/test_fixtures.rb +1 -1
- data/lib/active_record/timestamp.rb +0 -1
- data/lib/active_record/touch_later.rb +1 -2
- data/lib/active_record/transactions.rb +8 -8
- data/lib/active_record/type.rb +0 -1
- data/lib/active_record/type/adapter_specific_registry.rb +2 -5
- data/lib/active_record/type/hash_lookup_type_map.rb +0 -1
- data/lib/active_record/type/serialized.rb +0 -1
- data/lib/active_record/type/type_map.rb +0 -1
- data/lib/active_record/type/unsigned_integer.rb +0 -1
- data/lib/active_record/validations.rb +2 -3
- data/lib/active_record/validations/associated.rb +1 -2
- data/lib/arel.rb +5 -1
- data/lib/arel/predications.rb +5 -6
- data/lib/arel/visitors/depth_first.rb +0 -1
- data/lib/arel/visitors/dot.rb +0 -1
- data/lib/arel/visitors/mssql.rb +0 -1
- data/lib/arel/visitors/oracle.rb +1 -2
- data/lib/arel/visitors/oracle12.rb +0 -1
- data/lib/arel/visitors/postgresql.rb +0 -1
- data/lib/arel/visitors/sqlite.rb +0 -1
- data/lib/arel/visitors/to_sql.rb +0 -1
- data/lib/arel/visitors/visitor.rb +0 -1
- data/lib/arel/visitors/where_sql.rb +0 -1
- data/lib/rails/generators/active_record/application_record/application_record_generator.rb +0 -1
- data/lib/rails/generators/active_record/migration.rb +0 -1
- data/lib/rails/generators/active_record/migration/templates/migration.rb.tt +1 -1
- data/lib/rails/generators/active_record/model/model_generator.rb +0 -1
- metadata +14 -13
@@ -98,7 +98,7 @@ module ActiveRecord
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def rollback_records
|
101
|
-
ite = records.uniq(&:
|
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(&:
|
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|
|
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
|
-
|
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
|
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
|
@@ -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(
|
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(
|
77
|
-
|
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")
|
@@ -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.
|
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[-
|
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[-
|
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
|
|
@@ -166,8 +166,12 @@ module ActiveRecord
|
|
166
166
|
end
|
167
167
|
|
168
168
|
private
|
169
|
-
def
|
170
|
-
|
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.
|