Permalink
Browse files

Convert Fixnum into String the port number in MySQL

  • Loading branch information...
1 parent 6c2810b commit bc5148da3d39ed86fd056698a7dd285ac543c55a @chocoby chocoby committed Aug 11, 2013
@@ -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
@@ -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

1 comment on commit bc5148d

Member

arthurnn commented on bc5148d Dec 13, 2013

❤️

Please sign in to comment.