class CouchdbToSql::TableDeletedMarker
Table definition handler for handling database UPSERT operations.
Public Instance Methods
execute()
click to toggle source
# File lib/couchdb_to_sql/table_deleted_marker.rb, line 10 def execute dataset = handler.database[table_name] handler.changes.log_info "Deletion with additional info present (#{primary_key} '#{handler.id}'), assuming tombstone. " \ 'Updating data in SQL/Postgres database with data from CouchDB document.' fields = attributes.merge( _deleted: true, _deleted_timestamp: Sequel::CURRENT_TIMESTAMP, rev: handler.rev ) dataset .insert_conflict( target: primary_key, update: fields ) .insert(fields) end
key_filter()
click to toggle source
# File lib/couchdb_to_sql/table_deleted_marker.rb, line 28 def key_filter { primary_key => handler.id } end