Open DFrenkel opened 11 years ago
I am getting same issue here. it seems like postgresql_version
method isn't existed anywhere.
Downgraded to 1.0.1 fixed the problem. -- https://github.com/bmabey/database_cleaner/issues/224#issuecomment-22031253
I saw the same error, but instead I was using the OracleEnhanced adapter only. When it called truncate_tables, it used the PostgreSQLAdapter version as that method doesn't exist in the OracleEnhnacedAdapter, which led to the same error regarding an undefined postgresql_version method.
Downgrading to 1.0.1 fixed the problem for me as well.
9bf038d5c287cca98612fb0a76e58147d3694868 is the culprit, cc @bmabey @tommeier
Awaiting testers on https://github.com/bmabey/database_cleaner/pull/221
Was this fixed by DatabaseCleaner/database_cleaner#241?
Problem there:
class Deletion < Truncation
if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
include SelectiveTruncation
end
...
end
When both MySQL and Postgres ActiveRecord models are used, and when testing MySQL-backed code, Truncation strategy includes BOTH ::DatabaseCleaner::ActiveRecord::MysqlAdapter and ::DatabaseCleaner::ActiveRecord::PostgreSQLAdapter into ::DatabaseCleaner::ActiveRecord::AbstractAdapter, which, in turn, gets included into ActiveRecord::AbstractAdapter.
Since PostgreSQLAdapter gets included last, even when ActiveRecord::Base.connection is a MySQL connection, DatabaseCleaner attempts to execute Postgres-specific truncations, resulting in errors: