aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorThibault Jouan <tj@a13.fr>2012-12-27 21:50:55 +0000
committerThibault Jouan <tj@a13.fr>2012-12-30 15:21:04 +0000
commit494cfc373577850957844363a472ecd9c106f30a (patch)
treebf2a5e09d2b2271a75de856bccb959798e61ee68 /activerecord
parent257b3f63c4c73e369d789c7b10653398df7390f7 (diff)
downloadrails-494cfc373577850957844363a472ecd9c106f30a.tar.gz
rails-494cfc373577850957844363a472ecd9c106f30a.tar.bz2
rails-494cfc373577850957844363a472ecd9c106f30a.zip
Fix missing ending newline in db structure dump:
When dumping database structure with `rake db:structure:dump` and using migrations, the resulting file will not end with a newline char. Although it's not mandatory, it breaks a lot of simple use cases with programs like cat, more, grep, etc. This changes use `puts' instead of `<<' to append migration versions data to the dump and also split the line where this is happening as it was a bit long.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/railties/databases.rake4
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake
index b25c0270c2..259d0ff12b 100644
--- a/activerecord/lib/active_record/railties/databases.rake
+++ b/activerecord/lib/active_record/railties/databases.rake
@@ -300,7 +300,9 @@ db_namespace = namespace :db do
end
if ActiveRecord::Base.connection.supports_migrations?
- File.open(filename, "a") { |f| f << ActiveRecord::Base.connection.dump_schema_information }
+ File.open(filename, "a") do |f|
+ f.puts ActiveRecord::Base.connection.dump_schema_information
+ end
end
db_namespace['structure:dump'].reenable
end