<?xml version="1.0" encoding="UTF-8"?>
<changelog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://www.liquigraph.org/schema/1.0/liquigraph.xsd">
    <changeset id="PLATFORM-3046-Merge_settings_profiles:1" author="tnozhkina" run-on-change="true" run-always="true">
        <query>
            Match (i:Identity)-[:HAS_PROFILE]->(p:Profile {profileType: "SettingsProfile"}) 
            WITH i, collect(p) as all_profiles
            where length(all_profiles) > 1
            WITH i, all_profiles
               CALL apoc.refactor.mergeNodes(all_profiles,
                {
                    properties: "discard",
                    mergeRels: true
                }
               ) YIELD node
              RETURN i.id
        </query>
    </changeset>
</changelog>
