Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-4881 OpenMRS should support Postgresql
  3. TRUNK-5798

Add onDelete=CASCADE in liquibase changesets while creating tables wherever necessary

    XMLWordPrintable

Details

    • Sub-task
    • Status: Closed
    • Should
    • Resolution: Fixed
    • None
    • Core 2.4.0
    • None
    • None
    • Low

    Description

      By default hibernate relies on database level cascades. In OpenMRS data model, we have not specifically added onDelete=CASCADE where ever it was required. Due to this we get foreign key constraint violations when a parent object is deleted which is being referenced in other tables as foreign key.

      For example: When I am deleting the Patient forever I get a foreign key constraint error in table Patient.

      ERROR: update or delete on table "person" violates foreign key constraint "person_id_for_patient" on table "patient"

      Here is the link to the logs - https://pastebin.com/HF1P1Duu

      Link to the talk thread : https://talk.openmrs.org/t/patient-management-in-postgresql/28228/5

      Gliffy Diagrams

        Attachments

          Activity

            People

              aman Aman Mishra
              aman Aman Mishra
              Daniel Kayiwa Daniel Kayiwa
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: