Permalink
Browse files

Merge pull request #11839 from chocoby/fix/convert_port_number

Convert Fixnum into String the port number like `db:structure:dump` task in MySQL.
Conflicts:
	activerecord/CHANGELOG.md
  • Loading branch information...
1 parent 5e8129f commit 51ba5c9aad2ed3e3e76fb0972528096721799e6e @senny senny committed Oct 18, 2013
@@ -1,5 +1,9 @@
## unreleased ##
+* `rake db:structure:dump` no longer crashes when the port was specified as `Fixnum`.
+
+ *Kenta Okamoto*
+
* Fix a bug where rake db:structure:load crashed when the path contained
spaces.
@@ -134,8 +134,9 @@ def prepare_command_options(command)
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
@@ -280,6 +280,15 @@ def test_warn_when_external_structure_dump_fails
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

0 comments on commit 51ba5c9

Please sign in to comment.