mirror of
https://github.com/DatabaseCleaner/database_cleaner
synced 2023-03-27 23:22:03 -04:00
disables referential integrity in AR's delete strategy #90
This commit is contained in:
parent
501025b9de
commit
e8bade3abf
1 changed files with 4 additions and 2 deletions
|
@ -54,8 +54,10 @@ module DatabaseCleaner::ActiveRecord
|
|||
|
||||
def clean
|
||||
connection = connection_klass.connection
|
||||
tables_to_truncate(connection).each do |table_name|
|
||||
connection.delete_table table_name
|
||||
connection.disable_referential_integrity do
|
||||
tables_to_truncate(connection).each do |table_name|
|
||||
connection.delete_table table_name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue