I was looking through the liquibase-schema-only.xml which creates the base
schema for OpenMRS.

Changeset 1227303685425-232 generates the following constraint:
ALTER TABLE patient ADD CONSTRAINT person_id_for_patient FOREIGN KEY
patient_id REFERENCES person.person_id ON UPDATE CASCADE

I was left thinking how this has been working till now... patient_id is
auto-increment and person_id is also auto-increment and both are primary
keys of their respective tables viz. patient and person. Since we have an
UPDATE CASCADE, a new patient_id will be sent as person_id... but how is
that they will be able to generate the auto-incremented ids correctly??

How is it that primary key IDENTITY column is a FOREIGN KEY to another
table's IDENTITY PRIMARY KEY column?? I'm confused how this works?? and
isn't it logically incorrect??

---
Regards,
Saptarshi PURKAYASTHA

My Tech Blog:  http://sunnytalkstech.blogspot.com
You Live by CHOICE, Not by CHANCE

_________________________________________

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

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

Reply via email to