Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: placed code in code wiki tags

...

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);

...


SET foreign_key_checks = 1;

...


The first command disables foreign keys to allow deletion of the pt data. The second command deletes the pt data, but not user data, and the third command enables foreign keys again.