only dump schema information if migration table exists. Closes #14217

This commit is contained in:
Yves Senn 2014-03-20 10:30:30 +01:00
parent 7f7a40f4d2
commit eafec4694c
2 changed files with 9 additions and 1 deletions

@ -1,3 +1,10 @@
* `rake db:structure:dump` only dumps schema information if the schema
migration table exists.
Fixes #14217.
*Yves Senn*
* Reap connections that were checked out by now-dead threads, instead
of waiting until they disconnect by themselves. Before this change,
a suitably constructed series of short-lived threads could starve

@ -268,7 +268,8 @@ db_namespace = namespace :db do
current_config = ActiveRecord::Tasks::DatabaseTasks.current_config
ActiveRecord::Tasks::DatabaseTasks.structure_dump(current_config, filename)
if ActiveRecord::Base.connection.supports_migrations?
if ActiveRecord::Base.connection.supports_migrations? &&
ActiveRecord::SchemaMigration.table_exists?
File.open(filename, "a") do |f|
f.puts ActiveRecord::Base.connection.dump_schema_information
f.print "\n"