Skip to content

Commit

Permalink
Convert Fixnum into String the port number in MySQL
Browse files Browse the repository at this point in the history
  • Loading branch information
chocoby committed Oct 18, 2013
1 parent 6c2810b commit bc5148d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions activerecord/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion activerecord/lib/active_record/tasks/mysql_database_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions activerecord/test/cases/tasks/mysql_rake_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

1 comment on commit bc5148d

@arthurnn
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Please sign in to comment.