Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For OpenMRS v1.6, from there paste the following queries in and you're done.

Code Block

delete from obs;
delete from accesslogging_accesslog;
delete from encounter;
delete from patient_identifier;
delete from cohort_member;
delete from usagestatistics_usage;
delete from call_log;
delete from patient_program;
delete from sms_history;
delete from patient;
delete from person_address where person_id not in (select person_id from users);
delete from person_attribute where person_id not in (select person_id from users);
delete from person_name where person_id not in (select person_id from users);
delete from relationship;
delete from person where person_id not in (select person_id from users);

For OpenMRS v1.8.3, the command would need to take foreign keys into consideration and would look like this:

Code Block

SET foreign_key_checks = 0;
delete from obs;
delete from accesslogging_accesslog;
delete from encounter;
delete from patient_identifier;
delete from cohort_member;
delete from usagestatistics_usage;
delete from call_log;
delete from patient_program;
delete from sms_history;
delete from patient;
delete from person_address where person_id not in (select person_id from users);
delete from person_attribute where person_id not in (select person_id from users);
delete from person_name where person_id not in (select person_id from users);
delete from relationship;
delete from person where person_id not in (select person_id from users);
delete from alert_archive;
delete from alert_error;

SET foreign_key_checks = 1;

...