aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql
diff options
context:
space:
mode:
authorYoshiyuki Kinjo <yskkin@gmail.com>2019-04-13 01:11:39 +0900
committerYoshiyuki Kinjo <yskkin@gmail.com>2019-04-13 15:39:19 +0900
commit53f1b3e579e6d1969a244cd8e05590a46be6a96f (patch)
tree79089491c2c46766fd210b4775d78975ca37260a /activerecord/lib/active_record/connection_adapters/postgresql
parent713f62430a42294dcb156cc8f38b41509a60d7a6 (diff)
downloadrails-53f1b3e579e6d1969a244cd8e05590a46be6a96f.tar.gz
rails-53f1b3e579e6d1969a244cd8e05590a46be6a96f.tar.bz2
rails-53f1b3e579e6d1969a244cd8e05590a46be6a96f.zip
use PostgreSQL's bulk_alter_table implementation
Running this migration on mysql at current master fails because `add_references_for_alter` is missing. ``` change_table :users, bulk: true do |t| t.references :article end ``` This is also true for postgresql adapter, but its `bulk_alter_table` implementation can fallback in such case. postgresql's implementation is desirable to prevent unknown failure like this.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb25
1 files changed, 0 insertions, 25 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
index 2a641cbe53..ec8af73d07 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
@@ -368,31 +368,6 @@ module ActiveRecord
SQL
end
- 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
-
# Renames a table.
# Also renames a table's primary key sequence if the sequence name exists and
# matches the Active Record default.