instance method
bulk_change_table
Ruby on Rails 7.0.10
Since v6.0.6 Last seen in v7.0.10 PrivateSignature
bulk_change_table(table_name, operations)
No documentation comment.
Parameters
-
table_namereq -
operationsreq
Source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 1610
def bulk_change_table(table_name, operations)
sql_fragments = []
non_combinable_operations = []
operations.each do |command, args|
table, arguments = args.shift, args
method = :"#{command}_for_alter"
if respond_to?(method, true)
sqls, procs = Array(send(method, table, *arguments)).partition { |v| v.is_a?(String) }
sql_fragments << sqls
non_combinable_operations.concat(procs)
else
execute "ALTER TABLE #{quote_table_name(table_name)} #{sql_fragments.join(", ")}" unless sql_fragments.empty?
non_combinable_operations.each(&:call)
sql_fragments = []
non_combinable_operations = []
send(command, table, *arguments)
end
end
execute "ALTER TABLE #{quote_table_name(table_name)} #{sql_fragments.join(", ")}" unless sql_fragments.empty?
non_combinable_operations.each(&:call)
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb line 1610
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::SchemaStatements