<?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="ACC-7566-create-abacus-profile:1" author="jpenner">
        <query>
            MATCH (v:Vendor {id: "*"})
            MATCH (i:Identity)
            WHERE i.id = 'e85c1593-cf8d-4bbb-a171-0980e62ccb2f'
            MERGE (increment:IncrementId {nodeName: 'Profile'})
                ON CREATE SET increment.id = 2
                ON MATCH SET increment.id = increment.id + 1
            CREATE (p:Profile {
                profileId: (increment.id-1),
                profileType: 'AbacusProfile',
                profileName: i.name,
                uuid: apoc.create.uuid(),
                roles: ['administrator'],
                fullCatalogAccess: true,
                brand: 'orchard',
                createdAt: datetime(),
                lastModifiedAt: datetime(),
                createdBy: 'database/ACC-7566-create-abacus-profile/e16693bc-7df1-4149-9fbc-d7a325c95809',
                lastModifiedBy: 'database/ACC-7566-create-abacus-profile/e16693bc-7df1-4149-9fbc-d7a325c95809'
            })
            MERGE (i)-[:HAS_PROFILE]->(p)
            MERGE (p)-[:HAS_ACCESS_TO]->(v)
            RETURN i,p;
        </query>
    </changeset>
</changelog>
