<?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="PLATFORM-Fix_insights_profile_access:1" author="tmartino" run-on-change="true">
        <query><![CDATA[
            MATCH (p:Profile {profileType: 'InsightsProfile', profileId: 10412})-[rel:HAS_ACCESS_TO]->(l:Label)
            WHERE l.uuid <> '75d4f198-1c9d-43b5-962d-55790fe558fb'
            WITH collect(rel) as rels, l, p, rel
            CALL apoc.refactor.rename.type("HAS_ACCESS_TO", "DELETED_HAS_ACCESS_TO", rels) 
            YIELD committedOperations
            RETURN committedOperations
        ]]></query>
        <query><![CDATA[
            MATCH (p:Profile {profileType: 'InsightsProfile', profileId: 10412})-[rel:DELETED_HAS_ACCESS_TO]->(l:Label)
            WHERE l.uuid <> '75d4f198-1c9d-43b5-962d-55790fe558fb'
            SET rel.updatedOn = datetime(), rel.updatedBy = '19d08c16-9ed3-4b38-89c2-9ea7c213267a'
            RETURN l.uuid, rel.updatedBy, p.uuid
        ]]></query>
        <query>
            CALL apoc.log.info("Finished fix_insights_profile_access");
        </query>
    </changeset>
</changelog>
