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


96
97
98
99
100
101
# File 'lib/database_cleaner/active_record/truncation.rb', line 96

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


104
105
106
# File 'lib/database_cleaner/active_record/truncation.rb', line 104

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