From a6236266aa15a6c1e90bf86354fd16ffb04b1fe5 Mon Sep 17 00:00:00 2001 From: Tom Wier Date: Thu, 1 Aug 2024 11:43:18 +0300 Subject: [PATCH] feat: add delete clause for data_record and contact --- models/contacts/contact.sql | 1 + models/forms/data_record.sql | 1 + 2 files changed, 2 insertions(+) diff --git a/models/contacts/contact.sql b/models/contacts/contact.sql index 87376de0..da5035be 100644 --- a/models/contacts/contact.sql +++ b/models/contacts/contact.sql @@ -32,6 +32,7 @@ INNER JOIN ON source_table._id = document_metadata.uuid WHERE document_metadata.doc_type IN ('contact', 'clinic', 'district_hospital', 'health_center', 'person') + AND document_metadata._deleted = false {% if is_incremental() %} AND document_metadata.saved_timestamp >= {{ max_existing_timestamp('saved_timestamp') }} {% endif %} diff --git a/models/forms/data_record.sql b/models/forms/data_record.sql index 02cc1b80..46e9e0f7 100644 --- a/models/forms/data_record.sql +++ b/models/forms/data_record.sql @@ -44,6 +44,7 @@ INNER JOIN ON source_table._id = document_metadata.uuid WHERE document_metadata.doc_type = 'data_record' + AND document_metadata._deleted = false {% if is_incremental() %} AND document_metadata.saved_timestamp >= {{ max_existing_timestamp('saved_timestamp') }} {% endif %}