Class: ActiveRecord::ConnectionAdapters::SQLServerAdapter

Inherits:
AbstractAdapter
  • Object
show all
Defined in:
lib/database_cleaner/active_record/deletion.rb,
lib/database_cleaner/active_record/truncation.rb

Instance Method Summary collapse

Methods inherited from AbstractAdapter

#truncate_tables, #views

Instance Method Details

#delete_table(table_name) ⇒ Object



37
38
39
# File 'lib/database_cleaner/active_record/deletion.rb', line 37

def delete_table(table_name)
  execute("DELETE FROM #{quote_table_name(table_name)};")
end

#truncate_table(table_name) ⇒ Object



106
107
108
109
110
111
112
# File 'lib/database_cleaner/active_record/truncation.rb', line 106

def truncate_table(table_name)
  begin
    execute("TRUNCATE TABLE #{quote_table_name(table_name)};")
  rescue ActiveRecord::StatementInvalid
    execute("DELETE FROM #{quote_table_name(table_name)};")
  end
end