...
Code Block |
---|
SET foreign_key_checks = 0; TRUNCATE TABLE obs; TRUNCATE TABLE encounter; TRUNCATE TABLE accesslogging_accesslog; TRUNCATE TABLE patient_identifier; TRUNCATE TABLE cohort_member; TRUNCATE TABLE usagestatistics_usage; TRUNCATE TABLE call_log; TRUNCATE TABLE patient_program; TRUNCATE TABLE sms_history; TRUNCATE TABLE patient; delete from person_address where person_id not in (select person_id from users) ORAND person_id not in (SELECT person_id FROM provider); delete from person_attribute where person_id not in (select person_id from users) ORAND person_id not in (SELECT person_id FROM provider); delete from person_name where person_id not in (select person_id from users) ORAND person_id not in (SELECT person_id FROM provider); delete from person where person_id not in (select person_id from users) ORAND person_id not in (SELECT person_id FROM provider); TRUNCATE TABLE relationship; delete from person where person_id not in (select person_id from users) ORAND person_id not in (SELECT person_id FROM provider); TRUNCATE TABLE alert_archive; TRUNCATE TABLE alert_error; TRUNCATE TABLE visit; TRUNCATE TABLE visit_attribute; TRUNCATE TABLE cashier_bill; TRUNCATE TABLE cashier_bill_line_item; TRUNCATE TABLE cashier_bill_payment; TRUNCATE TABLE cashier_bill_payment_attribute; TRUNCATE TABLE active_list; TRUNCATE TABLE encounter_provider; TRUNCATE TABLE idgen_log_entry; TRUNCATE TABLE idgen_pooled_identifier; TRUNCATE TABLE note; TRUNCATE TABLE orders; TRUNCATE TABLE patient_state; TRUNCATE TABLE person_merge_log; TRUNCATE TABLE test_order; TRUNCATE TABLE xforms_person_repeat_attribute; SET foreign_key_checks = 1; |
...
Code Block |
---|
SET foreign_key_checks = 0; TRUNCATE TABLE obs; TRUNCATE TABLE encounter; TRUNCATE TABLE accesslogging_accesslog; TRUNCATE TABLE patient_identifier; TRUNCATE TABLE cohort_member; TRUNCATE TABLE usagestatistics_usage; TRUNCATE TABLE call_log; TRUNCATE TABLE patient_program; TRUNCATE TABLE sms_history; TRUNCATE TABLE patient; delete from person_address where person_id not in (select person_id from users) ORAND person_id not in (SELECT person_id FROM provider); delete from person_attribute where person_id not in (select person_id from users) ORAND person_id not in (SELECT person_id FROM provider); delete from person_name where person_id not in (select person_id from users) ORAND person_id not in (SELECT person_id FROM provider); delete from person where person_id not in (select person_id from users) ORAND person_id not in (SELECT person_id FROM provider); TRUNCATE TABLE relationship; delete from person where person_id not in (select person_id from users) ORAND person_id not in (SELECT person_id FROM provider); TRUNCATE TABLE alert_archive; TRUNCATE TABLE alert_error; TRUNCATE TABLE visit; TRUNCATE TABLE visit_attribute; TRUNCATE TABLE cashier_bill; TRUNCATE TABLE cashier_bill_line_item; TRUNCATE TABLE cashier_bill_payment; TRUNCATE TABLE cashier_bill_payment_attribute; TRUNCATE TABLE active_list; TRUNCATE TABLE encounter_provider; TRUNCATE TABLE idgen_log_entry; TRUNCATE TABLE idgen_pooled_identifier; TRUNCATE TABLE note; TRUNCATE TABLE orders; TRUNCATE TABLE patient_state; TRUNCATE TABLE person_merge_log; TRUNCATE TABLE test_order; TRUNCATE TABLE xforms_person_repeat_attribute; TRUNCATE TABLE allergy; TRUNCATE TABLE allergy_attribute; SET foreign_key_checks = 1; |
...