<?xml version="1.0" encoding="UTF-8"?>
<changelog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <changeset id="CDAM-2705_remove_rel_duplicate_lsr:1" author="mdadhania" run-always="true">
        <cypherquery>
            <![CDATA[
                MATCH (p:Product:Orchard)
                WHERE p.upc IN ['5060454940845', '5056167103400', '5060454945727']
                MATCH (p)--(t:Track:Orchard)-[rel:IS_PLACEMENT_OF]->(lsr:LabelSoundRecording)
                WHERE lsr.vendorId <> 72278
                DELETE rel
                WITH t
                MATCH (t)-[rel1:IS_PLACEMENT_OF]-(lsr1:LabelSoundRecording)
                WHERE lsr1.vendorId = 72278
                SET lsr1.name = t.name
                WITH lsr1
                MATCH (gsr:GlobalSoundRecording {isrc: lsr1.isrc})
                MERGE (gsr)-[:REPRESENTS]->(lsr1)
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="CDAM-2705_remove_rel_duplicate_lsr:2" author="mdadhania" run-always="true">
        <cypherquery>
            <![CDATA[
                MATCH (p:Product:Orchard)
                WHERE p.upc IN ['5056167104896', '93624997481']
                MATCH (p)--(t:Track:Orchard)-[rel:IS_PLACEMENT_OF]->(lsr:LabelSoundRecording)
                WHERE lsr.vendorId <> 72288
                DELETE rel
                WITH t
                MATCH (t)-[rel1:IS_PLACEMENT_OF]-(lsr1:LabelSoundRecording)
                WHERE lsr1.vendorId = 72288
                SET lsr1.name = t.name
                WITH lsr1
                MATCH (gsr:GlobalSoundRecording {isrc: lsr1.isrc})
                MERGE (gsr)-[:REPRESENTS]->(lsr1)
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="CDAM-2705_remove_rel_duplicate_lsr:3" author="mdadhania" run-always="true">
        <cypherquery>
            <![CDATA[
                MATCH (p:Product:Orchard)
                WHERE p.upc IN ['93624928461', '5056167104889']
                MATCH (p)--(t:Track:Orchard)-[rel:IS_PLACEMENT_OF]->(lsr:LabelSoundRecording)
                WHERE lsr.vendorId <> 72289
                DELETE rel
                WITH t
                MATCH (t)-[rel1:IS_PLACEMENT_OF]-(lsr1:LabelSoundRecording)
                WHERE lsr1.vendorId = 72289
                SET lsr1.name = t.name
                WITH lsr1
                MATCH (gsr:GlobalSoundRecording {isrc: lsr1.isrc})
                MERGE (gsr)-[:REPRESENTS]->(lsr1)
            ]]>
        </cypherquery>
    </changeset>
</changelog>
