Hi Michael,

Assuming you're using mysql, you can disable foreign key checks, delete,
and then reenable them.

Something like this:
SET foreign_key_checks = 0;
DELETE FROM obs;
SET foreign_key_checks = 1;

-Darius

PS- Would you mind commenting to that effect on the wiki page, once you've
verified that this works?

On Sat, Feb 11, 2012 at 1:49 PM, mmorris <[email protected]> wrote:

> When I try to run the command posted on the wiki I get the following error:
>
> #1451 - Cannot delete or update a parent row: a foreign key constraint
> fails
> (`NHTest`.`obs`, CONSTRAINT `obs_grouping_id` FOREIGN KEY (`obs_group_id`)
> REFERENCES `obs` (`obs_id`))
>
> I get the same error when trying to manually truncate the table.  Since
> this
> foreign key doesnt reference another table I can't use a similar solution
> to
> the other solution for the person table reported earlier.  Please help.
>
> Wiki article below:
>
> https://wiki.openmrs.org/display/docs/How+to+delete+or+erase+all+patients+and+patient+data+from+OpenMRS
>
> --
> View this message in context:
> http://openmrs-mailing-list-archives.1560443.n2.nabble.com/Delete-all-patients-and-their-data-from-OpenMRS-instance-tp7109835p7276770.html
> Sent from the Implementers mailing list archive at Nabble.com.
>
> _________________________________________
>
> To unsubscribe from OpenMRS Implementers' mailing list, send an e-mail to
> [email protected] with "SIGNOFF openmrs-implement-l" in the
>  body (not the subject) of your e-mail.
>
> [mailto:[email protected]?body=SIGNOFF%20openmrs-implement-l]
>

_________________________________________

To unsubscribe from OpenMRS Implementers' mailing list, send an e-mail to 
[email protected] with "SIGNOFF openmrs-implement-l" in the  body 
(not the subject) of your e-mail.

[mailto:[email protected]?body=SIGNOFF%20openmrs-implement-l]

Reply via email to