diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-07-24 14:46:25 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-08-06 08:25:18 +0200 |
commit | 53dba73dc17502b3d3f71d4672e86a14b995a732 (patch) | |
tree | c8a68d429f63b9419c7b90b9f69a3000b18b7b28 /activerecord | |
parent | acb371ca3fbbe3123d8d5b411ae2f2fb0b51ed7b (diff) | |
download | rails-53dba73dc17502b3d3f71d4672e86a14b995a732.tar.gz rails-53dba73dc17502b3d3f71d4672e86a14b995a732.tar.bz2 rails-53dba73dc17502b3d3f71d4672e86a14b995a732.zip |
Revert "Revert "Merge pull request #15394 from morgoth/fix-automatic-maintaining-test-schema-for-sql-format""
This reverts commit 5c87b5c5248154cf8aa76cce9a24a88769de022d.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/CHANGELOG.md | 9 | ||||
-rw-r--r-- | activerecord/lib/active_record/tasks/database_tasks.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/tasks/sqlite_database_tasks.rb | 6 |
3 files changed, 15 insertions, 2 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 9043542fda..103f657306 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -297,7 +297,14 @@ Fixes #8328. - *Sean Griffin* + Sean Griffin + +* Fixed automatic maintaining test schema to properly handle sql structure + schema format. + + Fixes #15394. + + *Wojciech Wnętrzak* * Pluck now works when selecting columns from different tables with the same name. diff --git a/activerecord/lib/active_record/tasks/database_tasks.rb b/activerecord/lib/active_record/tasks/database_tasks.rb index 72e0cf3723..659110c066 100644 --- a/activerecord/lib/active_record/tasks/database_tasks.rb +++ b/activerecord/lib/active_record/tasks/database_tasks.rb @@ -188,10 +188,12 @@ module ActiveRecord when :ruby file ||= File.join(db_dir, "schema.rb") check_schema_file(file) + purge(current_config) load(file) when :sql file ||= File.join(db_dir, "structure.sql") check_schema_file(file) + purge(current_config) structure_load(current_config, file) else raise ArgumentError, "unknown format #{format.inspect}" diff --git a/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb b/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb index 5688931db2..9ab64d0325 100644 --- a/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb @@ -21,7 +21,11 @@ module ActiveRecord FileUtils.rm(file) if File.exist?(file) end - alias :purge :drop + + def purge + drop + create + end def charset connection.encoding |