mirror of
https://github.com/DatabaseCleaner/database_cleaner
synced 2023-03-27 23:22:03 -04:00
removes dropping of mongo indexes, see url below for more info
9323d6c3a0
This commit is contained in:
parent
8094293085
commit
8c13f57a7a
2 changed files with 6 additions and 8 deletions
|
@ -1,5 +1,8 @@
|
|||
== 0.6.2 (in git)
|
||||
|
||||
=== Bugfixes
|
||||
* Reversed GH-41 after larger community discussion. Mongo indexes are no longer dropped. (Ben Mabey)
|
||||
|
||||
== 0.6.1 2011-01-27
|
||||
|
||||
=== New Features
|
||||
|
|
|
@ -1,22 +1,17 @@
|
|||
module DatabaseCleaner
|
||||
module Mongo
|
||||
module Truncation
|
||||
|
||||
|
||||
def clean
|
||||
if @only
|
||||
collections.each { |c| remove(c) if @only.include?(c.name) }
|
||||
collections.each { |c| c.remove if @only.include?(c.name) }
|
||||
else
|
||||
collections.each { |c| remove(c) unless @tables_to_exclude.include?(c.name) }
|
||||
collections.each { |c| c.remove unless @tables_to_exclude.include?(c.name) }
|
||||
end
|
||||
true
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def remove(collection)
|
||||
collection.drop_indexes
|
||||
collection.remove
|
||||
end
|
||||
|
||||
def collections
|
||||
database.collections.select { |c| c.name !~ /^system/ }
|
||||
|
|
Loading…
Reference in a new issue