diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-03-17 16:27:04 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-03-17 20:34:04 +0100 |
commit | 274e966a6a5db0daf43928041120b29e66eb2c56 (patch) | |
tree | f3c0a6a7d3f0534082ae12f930f86dfcdde05e30 /activerecord/lib | |
parent | 8744632fb5649cf26cdcd1518a3554ece95a401b (diff) | |
download | rails-274e966a6a5db0daf43928041120b29e66eb2c56.tar.gz rails-274e966a6a5db0daf43928041120b29e66eb2c56.tar.bz2 rails-274e966a6a5db0daf43928041120b29e66eb2c56.zip |
`rake db:create` does not change permissions of root user.
Closes #8079.
I had to rework some of the tests because the mock allowed any arguments
for `connection.exeucte`. I think this is very dangerous as there could
anything be executed without the tests noticing it.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/tasks/mysql_database_tasks.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb index 10696258c9..50569d2462 100644 --- a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb @@ -26,7 +26,9 @@ module ActiveRecord $stdout.print error.error establish_connection root_configuration_without_database connection.create_database configuration['database'], creation_options - connection.execute grant_statement.gsub(/\s+/, ' ').strip + if configuration['username'] != 'root' + connection.execute grant_statement.gsub(/\s+/, ' ').strip + end establish_connection configuration else $stderr.puts "Couldn't create database for #{configuration.inspect}, #{creation_options.inspect}" |