10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# 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
|