<?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-7758-create-lambda-ledger-accounting-run-balance-profile:1" author="anavalu">
        <neo4j:cypher>
            <![CDATA[
                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: 'AbacusProfile',
                    profileName: 'lambda-abacus-ledger-accounting-run-balance',
                    roles: ['administrator'],
                    fullCatalogAccess: true,
                    uuid: apoc.create.uuid()
                })
                WITH profile
                CREATE (identity:Identity {
                    email: 'admin+lambda-abacus-ledger-accounting-run-balance@theorchard.com',
                    id: apoc.create.uuid(),
                    name: 'lambda-abacus-ledger-accounting-run-balance'
                })
                CREATE (identity)-[:HAS_PROFILE]->(profile)
            ]]>
        </neo4j:cypher>
    </changeSet>
</databaseChangeLog>
