forked from openmrs/openmrs-core
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TRUNK-4202 Convert Order.orderer to be a Provider
- Loading branch information
Showing
4 changed files
with
37 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6805,5 +6805,31 @@ | |
<comment>Removing discontinued_by from orders</comment> | ||
<dropColumn tableName="orders" columnName="discontinued_by" /> | ||
</changeSet> | ||
|
||
<changeSet id="201401081823-TRUNK-4202" author="k-joseph"> | ||
This comment has been minimized.
Sorry, something went wrong.
dkayiwa
|
||
<preConditions onFail="MARK_RAN"> | ||
<columnExists tableName="orders" columnName="orderer" /> | ||
</preConditions> | ||
<comment>Creating provider accounts for all users who have placed | ||
orders for patients and have no associated provider accounts | ||
</comment> | ||
<sql> | ||
INSERT INTO provider(person_id, identifier, creator, date_created, retired, uuid) | ||
SELECT orders.orderer, CONCAT('providerAccount', SUBSTRING(person.uuid, 5)), 1, | ||
CURRENT_TIMESTAMP, false, CONCAT('providerAccount', SUBSTRING(person.uuid, 5)) | ||
WHERE orders.patient_id IS NOT NULL AND orders.orderer NOT IN (SELECT person_id FROM provider) | ||
</sql> | ||
</changeSet> | ||
|
||
<changeSet id="201401081850-TRUNK-4202" author="k-joseph"> | ||
<preConditions onFail="MARK_RAN"> | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
k-joseph
Author
Owner
|
||
<columnExists tableName="provider" columnName="provider_id" /> | ||
</preConditions> | ||
<comment>Migrating data in orders.orderer column to be provider_ids</comment> | ||
<sql> | ||
UPDATE orders SET orderer = (SELECT provider_id FROM provider WHERE provider_id = orders.orderer) | ||
WHERE users.user_id IN (SELECT orders.orderer FROM orders) | ||
</sql> | ||
</changeSet> | ||
|
||
</databaseChangeLog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here you should do p.getName()