<?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="TAP-1550_grant_tap_access:1" author="mbalan" run-on-change="true" run-always="true">
        <query>
            MATCH (identity:Identity {email: 'serhii.laposhko.sme@sonymusic-pde.com'})
            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: 'DocumentsProfile',
                profileName: 'Serhii Laposhko',
                roles: ['payee_management'],
                uuid: apoc.create.uuid(),
                brand: 'theorchard',
                fullCatalogAccess: true,
                createdAt: datetime(),
                lastModifiedAt: datetime(),
                createdBy: 'database/TAP-1550_grant_tap_access:1',
                lastModifiedBy: 'database/TAP-1550_grant_tap_access:1'
            })
            MERGE (identity)-[:HAS_PROFILE]->(profile)
            WITH profile, identity
            MATCH (v:Vendor {id: '*'})
            MERGE (profile)-[:HAS_ACCESS_TO]->(v)
            RETURN identity,profile;
        </query>
    </changeset>
</changelog>