Module: DatabaseCleaner::ConnectionAdapters::SQLiteAdapter

Defined in:
lib/database_cleaner/active_record/truncation.rb

Instance Method Summary collapse

Instance Method Details

#delete_table(table_name) ⇒ Object Also known as: truncate_table



93
94
95
96
97
98
# File 'lib/database_cleaner/active_record/truncation.rb', line 93

def delete_table(table_name)
  execute("DELETE FROM #{quote_table_name(table_name)};")
  if uses_sequence
    execute("DELETE FROM sqlite_sequence where name = '#{table_name}';")
  end
end

#truncate_tables(tables) ⇒ Object



101
102
103
# File 'lib/database_cleaner/active_record/truncation.rb', line 101

def truncate_tables(tables)
  tables.each { |t| truncate_table(t) }
end