Skip to content

Commit

Permalink
Patch for the pg truncation adapter to prevent an emtpy list of table…
Browse files Browse the repository at this point in the history
…s from

generating an illegal TRUCATE TABLE statement.
  • Loading branch information
Michael-Keith Bernard committed Mar 8, 2012
1 parent fd3dc63 commit 1f3a68f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/database_cleaner/active_record/truncation.rb
Expand Up @@ -96,6 +96,7 @@ def truncate_table(table_name)
end

def truncate_tables(table_names)
return if table_names.nil? || table_names.empty?
execute("TRUNCATE TABLE #{table_names.map{|name| quote_table_name(name)}.join(', ')} #{restart_identity} #{cascade};")
end

Expand Down

0 comments on commit 1f3a68f

Please sign in to comment.