Module: DatabaseCleaner::ActiveRecord::ConnectionWrapper::SQLiteAdapter
- Defined in:
- lib/database_cleaner/active_record/truncation.rb
Instance Method Summary collapse
- #pre_count_tables(tables) ⇒ Object
- #pre_count_truncate_tables(tables) ⇒ Object
- #truncate_table(table_name) ⇒ Object
- #truncate_tables(tables) ⇒ Object
Instance Method Details
#pre_count_tables(tables) ⇒ Object
163 164 165 166 |
# File 'lib/database_cleaner/active_record/truncation.rb', line 163 def pre_count_tables(tables) sequences = fetch_sequences tables.select { |table| has_been_used?(table, sequences) } end |
#pre_count_truncate_tables(tables) ⇒ Object
159 160 161 |
# File 'lib/database_cleaner/active_record/truncation.rb', line 159 def pre_count_truncate_tables(tables) truncate_tables(pre_count_tables(tables)) end |
#truncate_table(table_name) ⇒ Object
148 149 150 151 152 153 |
# File 'lib/database_cleaner/active_record/truncation.rb', line 148 def truncate_table(table_name) super if uses_sequence? execute("DELETE FROM sqlite_sequence where name = '#{table_name}';") end end |
#truncate_tables(tables) ⇒ Object
155 156 157 |
# File 'lib/database_cleaner/active_record/truncation.rb', line 155 def truncate_tables(tables) tables.each { |t| truncate_table(t) } end |