<?xml version="1.0" encoding="UTF-8"?>
<changelog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./schema.xsd">

   <changeset id="WAR-1473_add_moneyhub_vendor_star_access:1" author="epohrebna" run-on-change="true">
        <cypherquery>
            <![CDATA[
            MATCH (identity:Identity {id: '75a90f27-133a-407d-88bb-daf5b22dfc93'})
            MERGE (increment:IncrementId {nodeName: 'Profile'})
                ON CREATE SET increment.id = 2
                ON MATCH SET increment.id = increment.id + 1
            CREATE (profile:Profile {
                profileId: (increment.id - 1),
                profileType: 'MoneyhubProfile',
                profileName: identity.name,
                brand: identity.defaultBrand,
                fullCatalogAccess: true,
                roles: ['accounting'],
                uuid: apoc.create.uuid()
            })
            MERGE (identity)-[:HAS_PROFILE]->(profile)
            WITH profile
            MATCH (vendor:Vendor {id: '*'})
            MERGE (profile)-[:HAS_ACCESS_TO]->(vendor)
            ]]>
        </cypherquery>
    </changeset>

     <changeset id="WAR-1473_add_moneyhub_vendor_star_access:2" author="epohrebna" run-on-change="true">
        <cypherquery>
            <![CDATA[
            MATCH (identity:Identity {id: '23bb8323-e2db-41d6-a3bd-a6a6d4eb7b08'})
            MERGE (increment:IncrementId {nodeName: 'Profile'})
                ON CREATE SET increment.id = 2
                ON MATCH SET increment.id = increment.id + 1
            CREATE (profile:Profile {
                profileId: (increment.id - 1),
                profileType: 'MoneyhubProfile',
                profileName: identity.name,
                brand: identity.defaultBrand,
                fullCatalogAccess: true,
                roles: ['accounting'],
                uuid: apoc.create.uuid()
            })
            MERGE (identity)-[:HAS_PROFILE]->(profile)
            WITH profile
            MATCH (vendor:Vendor {id: '*'})
            MERGE (profile)-[:HAS_ACCESS_TO]->(vendor)
            ]]>
        </cypherquery>
    </changeset>

</changelog>
