<?xml version="1.0" encoding="UTF-8"?>
<changelog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.liquigraph.org/schema/1.0/liquigraph.xsd">
    <changeset id="ARTARCH-586_artist_update:1" author="savva" run-on-change="true">
        <query>
            MATCH (masterNode:LabelParticipant {id: 197639200})
            MATCH (otherNode:LabelParticipant)
            WHERE otherNode.id IN [144147, 19922908]
            WITH masterNode, COLLECT(otherNode) AS otherNodes
            CALL apoc.refactor.mergeNodes(
                [masterNode] + otherNodes,
                {
                    properties: "discard",
                    mergeRels: false
                }
            ) YIELD node
            RETURN true
        </query>
    </changeset>
    <changeset id="ARTARCH-586_artist_update:2" author="savva" run-on-change="true">
        <query>
            MATCH (:LabelParticipant {id: 197639200})-[r:HAS_LABEL_PARTICIPANT]-(:Vendor)
            WITH TAIL(COLLECT(r)) AS duplicates
            UNWIND duplicates AS dup
            DELETE dup
        </query>
    </changeset>
    <changeset id="ARTARCH-586_artist_update:3" author="savva" run-on-change="true">
        <query>
            MATCH (:LabelParticipant {id: 197639200})-[r:REPRESENTS]-(:GlobalParticipant)
            WITH TAIL(COLLECT(r)) AS duplicates
            UNWIND duplicates AS dup
            DELETE dup
        </query>
    </changeset>
</changelog>
