diff --git a/lib/database_cleaner/active_record/deletion.rb b/lib/database_cleaner/active_record/deletion.rb index 4414e2d..4ea3a41 100644 --- a/lib/database_cleaner/active_record/deletion.rb +++ b/lib/database_cleaner/active_record/deletion.rb @@ -54,14 +54,14 @@ module DatabaseCleaner::ActiveRecord def tables_with_new_rows(connection) @db_name ||= connection.instance_variable_get('@config')[:database] - result = connection.execute("SELECT table_name FROM information_schema.tables WHERE table_schema = '#{@db_name}' AND table_rows > 0") - result.map{ |row| row[0] } - ['schema_migrations'] + result = connection.select_all("SELECT table_name FROM information_schema.tables WHERE table_schema = '#{@db_name}' AND table_rows > 0") + result.map{ |row| row.values[0] } - ['schema_migrations'] end def information_schema_exists? connection @information_schema_exists ||= begin - connection.execute("SELECT * FROM information_schema.tables") + connection.execute("SELECT 1 FROM information_schema.tables") true rescue false