Looks like tribe project is complete

Tribe module is ready to be checked in. I have attached the core OpenMRS system changes to the ticket. There is another update to the core system to allow registering module level FieldGenHandlers. I have written an SQL script to upgrade an existing implementation, by moving the patient tribe values to a person attribute type value as follows.

— disable auto commit
SET @currentAutoCommit = @@autocommit;
SET @@autocommit = 0;

START TRANSACTION;

— create the tribe person attribute type
INSERT INTO person_attribute_type
(name, description, format, creator, date_created)
VALUES (‘Tribe’, ‘Tribe of the person’, ‘org.openmrs.module.tribe.Tribe’, 1, NOW());

SET @tribeTypeId = LAST_INSERT_ID();

— insert person attributes for patient tribe values
INSERT INTO person_attribute (person_id, value, person_attribute_type_id, creator, date_created)
SELECT patient_id, tribe, @tribeTypeId, 1, now() FROM patient WHERE tribe IS NOT NULL;

— remove tribe column
ALTER TABLE patient DROP FOREIGN KEY belongs_to_tribe;
ALTER TABLE patient DROP COLUMN tribe;

— commit everything and restore auto commit value
COMMIT;
SET @@autocommit = @currentAutoCommit;

Advertisements
Explore posts in the same categories: OpenMRS

One Comment on “Looks like tribe project is complete”


  1. So early?!?!?!?! time to do more work! You still have 11 more weeks!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: