Having seen the Constraints missing in OpenMRS database, we need to validate that our Back up and restore mechanisms are getting the database schema along with Constraints.
Angshu : if you see there are constraints defined in “bed_location_map” and not on “obs” - take a dump like we do during backup - and on a different machine restore that (like we do in restore)
Default openmrs database dump which has integrity constraint issues ->
Base/Clean openmrs database dump which has all constraints ->
PR link: https://github.com/Bahmni/emr-functional-tests/pull/2
Adding missing constraints from clean dump sql file
in course of merge of openmrs and bahmni-emr rpms, the task for copying the default db from emr-functional-test/dbdump/openmrs_backup.sql.gz file was missed. This resulted the older openmrs_backup.sql file to be still present.
FIX: added a new file: build_scripts/bahmni_mrs/bahmni_mrs_copy_default_db.sh
Also modified: bahmni Bahmni_MRS_v0_92, pipeline package - added a task to execute the above script before actual packaging onto RPM.
The following 2 constraints are missing in the default setup.
CONSTRAINT location_for_auto_generation_option FOREIGN KEY (location) REFERENCES location (location_id)
2. Table order_frequency
CONSTRAINT order_frequency_concept_id_fk FOREIGN KEY (concept_id) REFERENCES concept (concept_id)