← Back to team overview

dhis2-devs team mailing list archive

Re: merging facilities (org-units) without losing data

 

Hey Jason And Knut, thanks for the information, i have been trying to
understand the sql script shared and tried to execute but to no effect,
please can you help me understand where to place the source id and orgunit
ids in the script after several attempts of try its has became more
complex.

I have attached a datavalue table and 1 duplicate orgunit to be merged.
please help me.

On Mon, Jan 8, 2018 at 8:26 PM, moses mwale <isoftcom.ic@xxxxxxxxx> wrote:

> Thanks very much, allow me to go through and implement the given knowledge
>
> On Sun, Jan 7, 2018 at 11:29 PM, Jason Pickering <
> jason.p.pickering@xxxxxxxxx> wrote:
>
>> Hi Moses
>> We have some SQL scripts for this here.
>>
>> https://github.com/dhis2/dhis2-utils/blob/master/resources/
>> sql/merge_orgunits.sql
>>
>> This script will not handle tracker data but could probably be adapted
>> fairly easily to do so.
>>
>> Regards,
>> Jason
>>
>>
>>
>> On Jan 7, 2018 7:28 AM, "Knut Staring" <knutst@xxxxxxxxx> wrote:
>>
>>> Hi Moses,
>>> I would take a backup of the database and then do this with an sql
>>> script, just changing the sourceid (the database internal referent to the
>>> organisationunitid) in the datavalues table. But you may get blocked if the
>>> same period has been filled for both, in which case you may want to do a
>>> "NOT IN" or left join.
>>>
>>> Knut
>>>
>>> On Jan 7, 2018 10:29, "moses mwale" <isoftcom.ic@xxxxxxxxx> wrote:
>>>
>>>> Hey devs is it possible to merge facilities without losing data, some
>>>> admin accidentally created other duplicates units into the system. anyone
>>>> knows how its done?
>>>>
>>>> developer_lusaka_systems
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>> More help   : https://help.launchpad.net/ListHelp
>>>>
>>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~dhis2-devs
>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>
>
> --
> developer_lusaka_systems
>



-- 
developer_lusaka_systems

Attachment: datavalue table.PNG
Description: PNG image

Attachment: Duplicate_to_merge.PNG
Description: PNG image


Follow ups

References