database_cleaner-sequel
database_cleaner-sequel copied to clipboard
Truncation via Sequel fails on Mysql when foreign key constraints are present
ActiveRecord has disable_referential_integrity; unfortunately Sequel doesn't. Documentation for working around this would be very useful. (Maybe doing a raw SQL statement to disable foreign keys before doing the clean?)
@contentfree A bit late, but I ran into the same issue. I am using MySQL and solved it like this:
DB.run('SET FOREIGN_KEY_CHECKS=0;')
DatabaseCleaner.clean_with(:truncation)
DB.run('SET FOREIGN_KEY_CHECKS=1;')