Skip to content
This repository
Browse code

Fix GH #5435. db:structure:dump should be re-enable.

  • Loading branch information...
commit f4f9ec153685d3a672588c5f5db85658a7fb6f76 1 parent 41815f5
Toshinori Kajihara authored March 18, 2012
1  activerecord/lib/active_record/railties/databases.rake
@@ -407,6 +407,7 @@ db_namespace = namespace :db do
407 407
       if ActiveRecord::Base.connection.supports_migrations?
408 408
         File.open(filename, "a") { |f| f << ActiveRecord::Base.connection.dump_schema_information }
409 409
       end
  410
+      db_namespace['structure:dump'].reenable
410 411
     end
411 412
 
412 413
     # desc "Recreate the databases from the structure.sql file"
12  railties/test/application/rake_test.rb
@@ -138,5 +138,17 @@ def test_rake_dump_structure_should_respect_db_structure_env_variable
138 138
       end
139 139
       assert File.exists?(File.join(app_path, 'db', 'my_structure.sql'))
140 140
     end
  141
+
  142
+    def test_rake_dump_structure_should_be_called_twice_when_migrate_redo
  143
+      add_to_config "config.active_record.schema_format = :sql"
  144
+
  145
+      output = Dir.chdir(app_path) do
  146
+        `rails g model post title:string;
  147
+         bundle exec rake db:migrate:redo 2>&1 --trace;`
  148
+      end
  149
+
  150
+      # expect only Invoke db:structure:dump (first_time)
  151
+      assert_no_match(/^\*\* Invoke db:structure:dump\s+$/, output)
  152
+    end
141 153
   end
142 154
 end

0 notes on commit f4f9ec1

Please sign in to comment.
Something went wrong with that request. Please try again.