added TRUNCADE CASCADE for Postgres (for truncating tables with FKs)

This commit is contained in:
yozhyk 2009-08-21 01:05:16 +08:00 committed by Ben Mabey
parent 1a37b0daed
commit 670dc0f71d
2 changed files with 4 additions and 4 deletions

6
database_cleaner.gemspec Normal file → Executable file
View File

@ -2,11 +2,11 @@
Gem::Specification.new do |s|
s.name = %q{database_cleaner}
s.version = "0.2.3"
s.version = "0.2.4"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Ben Mabey"]
s.date = %q{2009-05-30}
s.authors = ["Ben Mabey", "Yozhyk"]
s.date = %q{2009-08-20}
s.description = %q{Strategies for cleaning databases. Can be used to ensure a clean state for testing.}
s.email = %q{ben@benmabey.com}
s.extra_rdoc_files = [

2
lib/database_cleaner/active_record/truncation.rb Normal file → Executable file
View File

@ -23,7 +23,7 @@ module ActiveRecord
class PostgreSQLAdapter
def truncate_table(table_name)
execute("TRUNCATE TABLE #{quote_table_name(table_name)};")
execute("TRUNCATE TABLE #{quote_table_name(table_name)} CASCADE;")
end
end