diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-10-18 07:15:31 -0700 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-10-18 07:15:31 -0700 |
commit | 7ec3f354958ef1709f1543b16fea5131b516f3cf (patch) | |
tree | 57180c23654391f38349d325c1c67de45343aa50 | |
parent | 6c2810b8ed692004dca43e554982cdfdb8517b80 (diff) | |
parent | bc5148da3d39ed86fd056698a7dd285ac543c55a (diff) | |
download | rails-7ec3f354958ef1709f1543b16fea5131b516f3cf.tar.gz rails-7ec3f354958ef1709f1543b16fea5131b516f3cf.tar.bz2 rails-7ec3f354958ef1709f1543b16fea5131b516f3cf.zip |
Merge pull request #11839 from chocoby/fix/convert_port_number
Convert Fixnum into String the port number like `db:structure:dump` task in MySQL.
-rw-r--r-- | activerecord/CHANGELOG.md | 4 | ||||
-rw-r--r-- | activerecord/lib/active_record/tasks/mysql_database_tasks.rb | 3 | ||||
-rw-r--r-- | activerecord/test/cases/tasks/mysql_rake_test.rb | 9 |
3 files changed, 15 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 2d19e44abc..815e7c71fe 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,7 @@ +* `rake db:structure:dump` no longer crashes when the port was specified as `Fixnum`. + + *Kenta Okamoto* + * `NullRelation#pluck` takes a list of columns The method signature in `NullRelation` was updated to mimic that in diff --git a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb index 50569d2462..c755831e6d 100644 --- a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb @@ -134,8 +134,9 @@ IDENTIFIED BY '#{configuration['password']}' WITH GRANT OPTION; args << "--password=#{configuration['password']}" if configuration['password'] args.concat(['--default-character-set', configuration['encoding']]) if configuration['encoding'] configuration.slice('host', 'port', 'socket').each do |k, v| - args.concat([ "--#{k}", v ]) if v + args.concat([ "--#{k}", v.to_s ]) if v end + args end end diff --git a/activerecord/test/cases/tasks/mysql_rake_test.rb b/activerecord/test/cases/tasks/mysql_rake_test.rb index 816bd62751..bdcf31043a 100644 --- a/activerecord/test/cases/tasks/mysql_rake_test.rb +++ b/activerecord/test/cases/tasks/mysql_rake_test.rb @@ -280,6 +280,15 @@ module ActiveRecord assert_match(/Could not dump the database structure/, warnings) end + + def test_structure_dump_with_port_number + filename = "awesome-file.sql" + Kernel.expects(:system).with("mysqldump", "--port", "10000", "--result-file", filename, "--no-data", "test-db").returns(true) + + ActiveRecord::Tasks::DatabaseTasks.structure_dump( + @configuration.merge('port' => 10000), + filename) + end end class MySQLStructureLoadTest < ActiveRecord::TestCase |