springbok
2010-09-10 08:56:06 UTC
Hi Eric,
I'm trying to install my test framework including rspec, I get the
following error when running "rake spec":
Task not supported by 'sqlanywhere'
When I trace the rake task it fails here:
/home/etienne/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.0/lib/
active_record/railties/databases.rake:453:in `block (3 levels) in <top
(required)>'
When I check the rake source I find that it fails in database.rake as
it does not support SQLA, i.e. :
# 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
There are a number of other tasks that execute DB specific commands
that do not currently support SQLA, for example:
desc "Dump the database structure to an SQL file"
task :dump => :environment do
# desc "Recreate the test databases from the development
structure"
task :clone_structure => [ "db:structure:dump", "db:test:purge" ]
do
plus others.
What would be the best approach for me to fix these problems do you
think? I could check each task and try and figure out the equivalent
SQLA utils/commands, but I'm not a 100% sure what the cleanest way
would be for me to add this to the current rake task??
Was this an issue in Rails2.x? I never actually used a test framework
with SQLA in Rails2.x so I don't know if that was a problem or not,
Any help appreciated as usual,
Etienne.
I'm trying to install my test framework including rspec, I get the
following error when running "rake spec":
Task not supported by 'sqlanywhere'
When I trace the rake task it fails here:
/home/etienne/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.0/lib/
active_record/railties/databases.rake:453:in `block (3 levels) in <top
(required)>'
When I check the rake source I find that it fails in database.rake as
it does not support SQLA, i.e. :
# 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
There are a number of other tasks that execute DB specific commands
that do not currently support SQLA, for example:
desc "Dump the database structure to an SQL file"
task :dump => :environment do
# desc "Recreate the test databases from the development
structure"
task :clone_structure => [ "db:structure:dump", "db:test:purge" ]
do
plus others.
What would be the best approach for me to fix these problems do you
think? I could check each task and try and figure out the equivalent
SQLA utils/commands, but I'm not a 100% sure what the cleanest way
would be for me to add this to the current rake task??
Was this an issue in Rails2.x? I never actually used a test framework
with SQLA in Rails2.x so I don't know if that was a problem or not,
Any help appreciated as usual,
Etienne.
--
You received this message because you are subscribed to the Google Groups "SQL Anywhere Web Development" group.
To post to this group, send email to sql-anywhere-web-***@googlegroups.com.
To unsubscribe from this group, send email to sql-anywhere-web-development+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sql-anywhere-web-development?hl=en.
You received this message because you are subscribed to the Google Groups "SQL Anywhere Web Development" group.
To post to this group, send email to sql-anywhere-web-***@googlegroups.com.
To unsubscribe from this group, send email to sql-anywhere-web-development+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sql-anywhere-web-development?hl=en.