aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Nogueira Neves <github@arthurnn.com>2016-06-17 12:23:50 -0400
committerGitHub <noreply@github.com>2016-06-17 12:23:50 -0400
commit6d4df1d3305ecacae26cfde71d06bd374c245418 (patch)
tree510d2cf52f9f91f62009d84f889773571268a749
parent30dd8b2cb0913b2ecc94d2b1d9e29b15e5913f71 (diff)
parent941a735bbeafd9068bba8d29fa1c7c5371ad8ce3 (diff)
downloadrails-6d4df1d3305ecacae26cfde71d06bd374c245418.tar.gz
rails-6d4df1d3305ecacae26cfde71d06bd374c245418.tar.bz2
rails-6d4df1d3305ecacae26cfde71d06bd374c245418.zip
Merge pull request #23301 from ppworks/improve_mysqldump
Improve mysqldump
-rw-r--r--activerecord/lib/active_record/tasks/mysql_database_tasks.rb1
-rw-r--r--activerecord/test/cases/tasks/mysql_rake_test.rb8
2 files changed, 5 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb
index af0c935342..b1a0ad0115 100644
--- a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb
+++ b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb
@@ -58,6 +58,7 @@ module ActiveRecord
args.concat(["--result-file", "#{filename}"])
args.concat(["--no-data"])
args.concat(["--routines"])
+ args.concat(["--skip-comments"])
args.concat(["#{configuration['database']}"])
run_cmd('mysqldump', args, 'dumping')
diff --git a/activerecord/test/cases/tasks/mysql_rake_test.rb b/activerecord/test/cases/tasks/mysql_rake_test.rb
index 8e480bbaee..70e406038f 100644
--- a/activerecord/test/cases/tasks/mysql_rake_test.rb
+++ b/activerecord/test/cases/tasks/mysql_rake_test.rb
@@ -289,7 +289,7 @@ module ActiveRecord
def test_structure_dump
filename = "awesome-file.sql"
- Kernel.expects(:system).with("mysqldump", "--result-file", filename, "--no-data", "--routines", "test-db").returns(true)
+ Kernel.expects(:system).with("mysqldump", "--result-file", filename, "--no-data", "--routines", "--skip-comments", "test-db").returns(true)
ActiveRecord::Tasks::DatabaseTasks.structure_dump(@configuration, filename)
end
@@ -297,7 +297,7 @@ module ActiveRecord
def test_warn_when_external_structure_dump_command_execution_fails
filename = "awesome-file.sql"
Kernel.expects(:system)
- .with("mysqldump", "--result-file", filename, "--no-data", "--routines", "test-db")
+ .with("mysqldump", "--result-file", filename, "--no-data", "--routines", "--skip-comments", "test-db")
.returns(false)
e = assert_raise(RuntimeError) {
@@ -308,7 +308,7 @@ module ActiveRecord
def test_structure_dump_with_port_number
filename = "awesome-file.sql"
- Kernel.expects(:system).with("mysqldump", "--port=10000", "--result-file", filename, "--no-data", "--routines", "test-db").returns(true)
+ Kernel.expects(:system).with("mysqldump", "--port=10000", "--result-file", filename, "--no-data", "--routines", "--skip-comments", "test-db").returns(true)
ActiveRecord::Tasks::DatabaseTasks.structure_dump(
@configuration.merge('port' => 10000),
@@ -317,7 +317,7 @@ module ActiveRecord
def test_structure_dump_with_ssl
filename = "awesome-file.sql"
- Kernel.expects(:system).with("mysqldump", "--ssl-ca=ca.crt", "--result-file", filename, "--no-data", "--routines", "test-db").returns(true)
+ Kernel.expects(:system).with("mysqldump", "--ssl-ca=ca.crt", "--result-file", filename, "--no-data", "--routines", "--skip-comments", "test-db").returns(true)
ActiveRecord::Tasks::DatabaseTasks.structure_dump(
@configuration.merge("sslca" => "ca.crt"),