<?xml version="1.0" encoding="UTF-8"?>
<changelog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <changeset id="NR-2319_clean_up_dedupe_participant:1" author="kturner" run-always="true">
    <cypherquery>
      <![CDATA[
        UNWIND [
          { id: "146e2579-7c19-4c56-92d7-a06564629989" },
          { id: "24dc304d-6e10-4f21-9fad-25a2608a5b4b" },
          { id: "3bb19286-fe64-458f-ae3b-5325261b3922" },
          { id: "fcccdcec-c529-4123-9ec9-fc8517567533" }, 
          { id: "a54563e6-868b-4695-a538-4ae017bb211d" }
        ] as pToMerge
        MATCH(pToKeep:NrParticipant:NrPerformance {id: "49f6a02a-dd0f-4883-bf48-e2d6763d08ee"})
        MATCH(p:NrParticipant:NrPerformance)<-[r:HAS_PRIMARY_ARTIST]-(sr:NrSoundRecording:NrPerformance)
        WHERE p.id = pToMerge.id
        WITH COLLECT(sr) as soundRecordings, r, pToKeep
        UNWIND soundRecordings as srToMerge
        MERGE(pToKeep)<-[:HAS_PRIMARY_ARTIST]-(srToMerge)
        DELETE r;
      ]]>
    </cypherquery>
  </changeset>
  <changeset id="NR-2319_clean_up_dedupe_participant:2" author="kturner" run-always="true">
    <cypherquery>
      <![CDATA[
        MATCH(pToKeep:NrParticipant:NrPerformance {id: "49f6a02a-dd0f-4883-bf48-e2d6763d08ee"})
        MATCH(pToMerge:NrParticipant:NrPerformance)<-[r:HAS_FEATURED_ARTIST]-(sr:NrSoundRecording:NrPerformance)
        WHERE pToMerge.id = "fcccdcec-c529-4123-9ec9-fc8517567533"
        WITH COLLECT(sr) as soundRecordings, r, pToKeep
        UNWIND soundRecordings as srToMerge
        MERGE(pToKeep)<-[:HAS_FEATURED_ARTIST]-(srToMerge)
        DELETE r;
      ]]>
    </cypherquery>
  </changeset>
</changelog>
