instance method bulk_change_table

Ruby on Rails 6.0.6

Since v6.0.6 Last seen in v7.0.10 Private

Available in: v6.0.6 v6.1.7.10 v7.0.10

Signature

bulk_change_table(table_name, operations)

No documentation comment.

Parameters

table_name req
operations req
Source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 1414
        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 1414 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::ConnectionAdapters::SchemaStatements

Type at least 2 characters to search.

↑↓ navigate · open · esc close