diff options
author | Thibault Jouan <tj@a13.fr> | 2012-12-27 21:50:55 +0000 |
---|---|---|
committer | Thibault Jouan <tj@a13.fr> | 2012-12-30 15:21:04 +0000 |
commit | 494cfc373577850957844363a472ecd9c106f30a (patch) | |
tree | bf2a5e09d2b2271a75de856bccb959798e61ee68 /activerecord | |
parent | 257b3f63c4c73e369d789c7b10653398df7390f7 (diff) | |
download | rails-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.rake | 4 |
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 |