这是我得到的错误:
Task not supported by 'mysql2'
/Users/me/.rvm/gems/ruby-1.8.7-p352@project/gems/rails-2.3.8/lib/tasks/databases.rake:380
以下是发生错误的arrea周围的代码:
desc "Empty the test database"
task :purge => :environment do
abcs = ActiveRecord::Base.configurations
case abcs["test"]["adapter"]
when "mysql"
ActiveRecord::Base.establish_connection(:test)
ActiveRecord::Base.connection.recreate_database(abcs["test"]["database"], abcs["test"])
when "postgresql"
ActiveRecord::Base.clear_active_connections!
drop_database(abcs['test'])
create_database(abcs['test'])
when "sqlite","sqlite3"
dbfile = abcs["test"]["database"] || abcs["test"]["dbfile"]
File.delete(dbfile) if File.exist?(dbfile)
when "sqlserver"
dropfkscript = "#{abcs["test"]["host"]}.#{abcs["test"]["database"]}.DP1".gsub(/\\/,'-')
`osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{dropfkscript}`
`osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{RAILS_ENV}_structure.sql`
when "oci", "oracle"
ActiveRecord::Base.establish_connection(:test)
ActiveRecord::Base.connection.structure_drop.split(";\n\n").each do |ddl|
ActiveRecord::Base.connection.execute(ddl)
end
when "firebird"
ActiveRecord::Base.establish_connection(:test)
ActiveRecord::Base.connection.recreate_database!
else
raise "Task not supported by '#{abcs["test"]["adapter"]}'"
end
end
第380行,最后是raise
行。
当我将其添加到mysql
案例时,一切都开始有效了:
when "mysql", "mysql2"
是否有更新版本的导轨已修复? (< 3.0?)?我不想告诉大家在想要运行测试时添加,"mysql2"
。 = \
或者这是rails 2.3.x中的错误吗?
我使用的是rails 2.3.8和ruby 1.8.7