bmabey/database_cleaner — Issue #79: Sequel ORM: Should use TRUNCATE ... CASCADE on Postgres
Author: bgentry
Created: 2011-11-08 00:53:21+00:00
State: open

Surprised this isn't built into the Sequel ORM. There's no simple way to do this other than running the SQL directly.

This doesn't work:

DatabaseCleaner.clean_with(:truncation, :except => [:schema_migrations])

This does:

(DB.tables - [:schema_migrations]).each do |table|
DB.run("TRUNCATE TABLE #{table} CASCADE;")
end