Class: CouchdbToSql::TableDestroyer

Inherits:
TableOperator show all
Defined in:
lib/couchdb_to_sql/table_destroyer.rb

Overview

The table destroyer will go through a table definition and make sure that all rows that belong to the document’s id are deleted from the system.

Instance Attribute Summary

Attributes inherited from TableOperator

#parent, #primary_key, #table_name

Instance Method Summary collapse

Methods inherited from TableOperator

#deduce_primary_key, #handler, #initialize

Constructor Details

This class inherits a constructor from CouchdbToSql::TableOperator

Instance Method Details

#executeObject



11
12
13
14
# File 'lib/couchdb_to_sql/table_destroyer.rb', line 11

def execute
  dataset = handler.database[table_name]
  dataset.where(key_filter).delete
end

#key_filterObject



16
17
18
19
20
# File 'lib/couchdb_to_sql/table_destroyer.rb', line 16

def key_filter
  {
    primary_key => handler.id
  }
end