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
157 158 159 160 |
# File 'lib/database_cleaner/active_record/truncation.rb', line 157 def pre_count_tables(tables) sequences = fetch_sequences tables.select { |table| has_been_used?(table, sequences) } end |
#pre_count_truncate_tables(tables) ⇒ Object
153 154 155 |
# File 'lib/database_cleaner/active_record/truncation.rb', line 153 def pre_count_truncate_tables(tables) truncate_tables(pre_count_tables(tables)) end |
#truncate_table(table_name) ⇒ Object
142 143 144 145 146 147 |
# File 'lib/database_cleaner/active_record/truncation.rb', line 142 def truncate_table(table_name) super if uses_sequence? execute("DELETE FROM sqlite_sequence where name = '#{table_name}';") end end |
#truncate_tables(tables) ⇒ Object
149 150 151 |
# File 'lib/database_cleaner/active_record/truncation.rb', line 149 def truncate_tables(tables) tables.each { |t| truncate_table(t) } end |