Added truncation support for Postgresql.

This commit is contained in:
Alberto Perdomo 2009-03-11 18:46:00 +00:00
parent ee0c0c2152
commit 80408434da
2 changed files with 8 additions and 1 deletions

View File

@ -19,6 +19,13 @@ module ActiveRecord
end
end
class PostgreSQLAdapter
def truncate_table(table_name)
execute("TRUNCATE TABLE #{table_name};")
end
end
end
end

View File

@ -3,7 +3,7 @@ require 'database_cleaner/active_record/truncation'
require 'active_record'
module ActiveRecord
module ConnectionAdapters
[MysqlAdapter, SQLite3Adapter, JdbcAdapter].each do |adapter|
[MysqlAdapter, SQLite3Adapter, JdbcAdapter, PostgreSQLAdapter].each do |adapter|
describe adapter, "#truncate_table" do
it "should truncate the table"
end