From 36ce0c2c821e2c9cca15e768842461f834825bf7 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Tue, 16 Dec 2014 09:58:34 +0100 Subject: `db:structure:load` and `db:schema:load` no longer purge the database. Closes #17945 `db:test:prepare` still purges the database to always keep the test database in a consistent state. This patch introduces new problems with `db:schema:load`. Prior to the introduction of foreign-keys, we could run this file against a non-empty database. Since every `create_table` containted the `force: true` option, this would recreate tables when loading the schema. However with foreign-keys in place, `force: true` wont work anymore and the task will crash. /cc @schneems --- activerecord/lib/active_record/tasks/database_tasks.rb | 2 -- 1 file changed, 2 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/tasks/database_tasks.rb b/activerecord/lib/active_record/tasks/database_tasks.rb index 1228de2bfd..6ed610e5f0 100644 --- a/activerecord/lib/active_record/tasks/database_tasks.rb +++ b/activerecord/lib/active_record/tasks/database_tasks.rb @@ -214,12 +214,10 @@ module ActiveRecord case format when :ruby check_schema_file(file) - purge(configuration) ActiveRecord::Base.establish_connection(configuration) load(file) when :sql check_schema_file(file) - purge(configuration) structure_load(configuration, file) else raise ArgumentError, "unknown format #{format.inspect}" -- cgit v1.2.3