# File lib/database_cleaner/sequel/truncation.rb, line 10 def clean case db.database_type when :postgres # PostgreSQL requires all tables with FKs to be truncates in the same command, or have the CASCADE keyword # appended. Bulk truncation without CASCADE is: # * Safer. Tables outside of tables_to_truncate won't be affected. # * Faster. Less roundtrips to the db. unless (tables= tables_to_truncate(db)).empty? all_tables= tables.map{|t| %Q["#{t}"]}.join ',' db.run "TRUNCATE TABLE #{all_tables};" end else # Truncate each table normally each_table do |db, table| db[table].truncate end end end
# File lib/database_cleaner/sequel/truncation.rb, line 29 def each_table tables_to_truncate(db).each do |table| yield db, table end end
overwritten
# File lib/database_cleaner/sequel/truncation.rb, line 42 def migration_storage_names %w[schema_info schema_migrations] end
# File lib/database_cleaner/sequel/truncation.rb, line 37 def tables_to_truncate(db) (@only || db.tables) - @tables_to_exclude end