diff --git a/migration/src/main/resources/migrations.xml b/migration/src/main/resources/migrations.xml index 2fee40b..1ef67b7 100644 --- a/migration/src/main/resources/migrations.xml +++ b/migration/src/main/resources/migrations.xml @@ -13,6 +13,7 @@ https://wiki.openmrs.org/display/docs/Prepare+for+Upgrading+From+a+Pre-1.10+to+1.10+or+Later+Version https://github.com/rwanda-rbc-emr/openmrs-module-mohbeforeoneelevenupgrade --> + diff --git a/migration/src/main/resources/migrations/ensure-forms-consider-practicing-providers.xml b/migration/src/main/resources/migrations/ensure-forms-consider-practicing-providers.xml new file mode 100644 index 0000000..a32a7d7 --- /dev/null +++ b/migration/src/main/resources/migrations/ensure-forms-consider-practicing-providers.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + SELECT count(*) FROM role WHERE role = "Practicing provider" + + + + INSERT INTO `role`( + role, + description, + uuid + ) + VALUES ( + "Practicing provider", + "Role to differentiate practicing providers from other user providers", + "36a4a54d-ab0a-11ea-8991-3c6aa7d72242" + ) + ; + + + + + + + + + SELECT count(*) FROM role WHERE role = "Practicing provider" + + + + + INSERT INTO user_role( + user_id, + role + ) + SELECT + distinct(US.user_id), + "Practicing provider" + FROM + provider Pr + LEFT JOIN + users US + ON + Pr.person_id=US.person_id + WHERE + US.retired!=1 AND Pr.retired!=1 + ; + + + UPDATE + htmlformentry_html_form + SET + xml_data = REPLACE(xml_data, ' + + +