Permalink
Browse files

break support mysql adapter

  • Loading branch information...
1 parent 47a87fb commit 4ea39b034c547d7ad75b944622a65622bb68dde7 @aderyabin committed Apr 28, 2012
View
@@ -6,7 +6,6 @@ rvm:
env:
- "GEM=railties"
- "GEM=ap,am,amo,as"
- - "GEM=ar:mysql"
- "GEM=ar:mysql2"
- "GEM=ar:sqlite3"
- "GEM=ar:postgresql"
@@ -22,9 +22,9 @@ environment variable:
You can run all the tests for a given database via rake:
- $ rake test_mysql
+ $ rake test_mysql2
-The 'rake test' task will run all the tests for mysql, mysql2, sqlite3 and postgresql.
+The 'rake test' task will run all the tests for mysql2, sqlite3 and postgresql.
== Config file
View
@@ -20,14 +20,14 @@ def run_without_aborting(*tasks)
abort "Errors running #{errors.join(', ')}" if errors.any?
end
-desc 'Run mysql, mysql2, sqlite, and postgresql tests by default'
+desc 'Run mysql2, sqlite, and postgresql tests by default'
task :default => :test
-desc 'Run mysql, mysql2, sqlite, and postgresql tests'
+desc 'Run mysql2, sqlite, and postgresql tests'
task :test do
tasks = defined?(JRUBY_VERSION) ?
%w(test_jdbcmysql test_jdbcsqlite3 test_jdbcpostgresql) :
- %w(test_mysql test_mysql2 test_sqlite3 test_postgresql)
+ %w(test_mysql2 test_sqlite3 test_postgresql)
run_without_aborting(*tasks)
end
@@ -40,7 +40,7 @@ namespace :test do
end
end
-%w( mysql mysql2 postgresql sqlite3 sqlite3_mem firebird db2 oracle sybase openbase frontbase jdbcmysql jdbcpostgresql jdbcsqlite3 jdbcderby jdbch2 jdbchsqldb ).each do |adapter|
+%w( mysql2 postgresql sqlite3 sqlite3_mem firebird db2 oracle sybase openbase frontbase jdbcmysql jdbcpostgresql jdbcsqlite3 jdbcderby jdbch2 jdbchsqldb ).each do |adapter|
Rake::TestTask.new("test_#{adapter}") { |t|
adapter_short = adapter == 'db2' ? adapter : adapter[/^[a-z0-9]+/]
t.libs << 'test'
@@ -85,17 +85,17 @@ task :test_sqlite3 => [
'test/fixtures/fixture_database_2.sqlite3'
]
-namespace :mysql do
+namespace :mysql2 do
desc 'Build the MySQL test databases'
task :build_databases do
- config = ARTest.config['connections']['mysql']
+ config = ARTest.config['connections']['mysql2']
%x( mysql --user=#{config['arunit']['username']} -e "create DATABASE #{config['arunit']['database']} DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci ")
%x( mysql --user=#{config['arunit2']['username']} -e "create DATABASE #{config['arunit2']['database']} DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci ")
end
desc 'Drop the MySQL test databases'
task :drop_databases do
- config = ARTest.config['connections']['mysql']
+ config = ARTest.config['connections']['mysql2']
%x( mysqladmin --user=#{config['arunit']['username']} -f drop #{config['arunit']['database']} )
%x( mysqladmin --user=#{config['arunit2']['username']} -f drop #{config['arunit2']['database']} )
end
@@ -104,9 +104,9 @@ namespace :mysql do
task :rebuild_databases => [:drop_databases, :build_databases]
end
-task :build_mysql_databases => 'mysql:build_databases'
-task :drop_mysql_databases => 'mysql:drop_databases'
-task :rebuild_mysql_databases => 'mysql:rebuild_databases'
+task :build_mysql2_databases => 'mysql2:build_databases'
+task :drop_mysql2_databases => 'mysql2:drop_databases'
+task :rebuild_mysql2_databases => 'mysql2:rebuild_databases'
namespace :postgresql do
@@ -76,7 +76,7 @@ def initialize(base)
def xml(*args)
raise NotImplementedError unless %w{
- sqlite mysql mysql2
+ sqlite mysql2
}.include? @base.adapter_name.downcase
options = args.extract_options!
@@ -259,7 +259,7 @@ def #{column_type}(*args) # def string(*args)
end # end
EOV
end
-
+
# Adds index options to the indexes hash, keyed by column name
# This is primarily used to track indexes that need to be created after the table
# === Examples
@@ -96,7 +96,7 @@ def missing_default_forged_as_empty_string?(default)
# behavior in versions 0.13.1 and earlier) you can add the following line
# to your application.rb file:
#
- # ActiveRecord::ConnectionAdapters::Mysql[2]Adapter.emulate_booleans = false
+ # ActiveRecord::ConnectionAdapters::Mysql2Adapter.emulate_booleans = false
class_attribute :emulate_booleans
self.emulate_booleans = true
@@ -64,6 +64,7 @@ def connection_url_to_hash(url) # :nodoc:
config = URI.parse url
adapter = config.scheme
adapter = "postgresql" if adapter == "postgres"
+ adapter = "mysql2" if adapter == "mysql"
spec = { :adapter => adapter,
:username => config.user,
:password => config.password,
Oops, something went wrong.

0 comments on commit 4ea39b0

Please sign in to comment.