<?xml version="1.0" encoding="UTF-8"?>
<changelog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <changeset id="CDAM-3856_remove_rel_duplicate_lsr:1" author="rpapat" run-always="true">
        <cypherquery>
            <![CDATA[
                MATCH (p:Product:Orchard)
                WHERE p.upc = '93624967705'
                MATCH (p)--(t:Track:Orchard)-[rel:IS_PLACEMENT_OF]->(lsr:LabelSoundRecording)
                WHERE t.id IN [37057906, 37057907, 37057908] AND lsr.vendorId = 65392
                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>
    <changeset id="CDAM-3856_remove_rel_duplicate_lsr:2" author="rpapat" run-always="true">
        <cypherquery>
            <![CDATA[
                MATCH (p:Product:Orchard)-[:INCLUDES]->(t:Track)-[rel:IS_PLACEMENT_OF]->(lsr:LabelSoundRecording)
                WHERE p.upc = '93624967705'
                    AND t.id IN [37057893, 37057896, 37057897, 37057898, 37057899, 37057900, 37057901, 37057902, 37057903, 37057904, 37057905]
                    AND lsr.vendorId = 65392
                DELETE rel
            ]]>
        </cypherquery>
    </changeset>
</changelog>
