<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
                   xmlns:neo4j="http://www.liquibase.org/xml/ns/dbchangelog-ext"
                   xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
    <changeSet id="ACC-8010-create-abacus-profile-for-aakash-kanojiya:1" author="anavalu">
        <neo4j:cypher>
            <![CDATA[
                MATCH (v:Vendor {id: "*"})
                MATCH (i:Identity)
                    WHERE i.id = '1323c857-0182-4584-9708-b1d641e6b6c5'
                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-8010-create-abacus-profile-for-aakash-kanojiya:1',
                    lastModifiedBy: 'database/ACC-8010-create-abacus-profile-for-aakash-kanojiya:1'
                })
                MERGE (i)-[:HAS_PROFILE]->(p)
                MERGE (p)-[:HAS_ACCESS_TO]->(v)
                RETURN i,p;
            ]]>
        </neo4j:cypher>
    </changeSet>
</databaseChangeLog>
