diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-01-12 11:19:02 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-01-12 11:19:02 -0200 |
commit | 6581d798e830a7820dd54fe95d40014c0e2057fe (patch) | |
tree | a1265bc7eafda4b69a1ca9ada16bc40ac8fa9bfc /activerecord/lib/active_record/tasks | |
parent | 2549a3b088de14c36d60de6c60c1374af75c326f (diff) | |
download | rails-6581d798e830a7820dd54fe95d40014c0e2057fe.tar.gz rails-6581d798e830a7820dd54fe95d40014c0e2057fe.tar.bz2 rails-6581d798e830a7820dd54fe95d40014c0e2057fe.zip |
Fix AR tests due to Mysql constant not being defined
Diffstat (limited to 'activerecord/lib/active_record/tasks')
3 files changed, 5 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb index 3ae5aa2cea..1b4ed1cac4 100644 --- a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb @@ -1,7 +1,6 @@ module ActiveRecord module Tasks # :nodoc: class MySQLDatabaseTasks # :nodoc: - DEFAULT_CHARSET = ENV['CHARSET'] || 'utf8' DEFAULT_COLLATION = ENV['COLLATION'] || 'utf8_unicode_ci' ACCESS_DENIED_ERROR = 1045 @@ -24,7 +23,7 @@ module ActiveRecord connection.create_database configuration['database'], creation_options connection.execute grant_statement.gsub(/\s+/, ' ').strip establish_connection configuration - rescue error_class, ActiveRecord::StatementInvalid => error + rescue ActiveRecord::StatementInvalid, error_class => error if /database exists/ === error.message raise DatabaseAlreadyExists else @@ -93,8 +92,10 @@ module ActiveRecord if configuration['adapter'] =~ /jdbc/ require 'active_record/railties/jdbcmysql_error' ArJdbcMySQL::Error - else - defined?(Mysql2) ? Mysql2::Error : Mysql::Error + elsif defined?(Mysql2) + Mysql2::Error + elsif defined?(Mysql) + Mysql::Error end end @@ -128,7 +129,6 @@ IDENTIFIED BY '#{configuration['password']}' WITH GRANT OPTION; end args end - end end end diff --git a/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb b/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb index e6a85b1917..0b1b030516 100644 --- a/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb @@ -3,7 +3,6 @@ require 'shellwords' module ActiveRecord module Tasks # :nodoc: class PostgreSQLDatabaseTasks # :nodoc: - DEFAULT_ENCODING = ENV['CHARSET'] || 'utf8' delegate :connection, :establish_connection, :clear_active_connections!, diff --git a/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb b/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb index 33c43c7774..de8b16627e 100644 --- a/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb @@ -1,7 +1,6 @@ module ActiveRecord module Tasks # :nodoc: class SQLiteDatabaseTasks # :nodoc: - delegate :connection, :establish_connection, to: ActiveRecord::Base def initialize(configuration, root = Rails.root) |