<?xml version="1.0" encoding="UTF-8"?>
<changelog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <changeset id="SR-268_add_distribution_profile:1" author="nlittmann" run-always="true">
        <cypherquery>
            <![CDATA[
                MATCH (identity:Identity {email: 'nils.littmann@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: 'DistributionProfile',
                    profileName: identity.name,
                    brand: identity.defaultBrand,
                    fullCatalogAccess: true,
                    roles: ['manage_nr_repertoire', 'manage_nr_deliveries', 'deliver_physical_audio'],
                    uuid: apoc.create.uuid()
                })
                MERGE (identity)-[:HAS_PROFILE]->(profile)
                WITH profile
                MATCH (vendor:Vendor {id: '*'})
                MERGE (profile)-[:HAS_ACCESS_TO]->(vendor)
            ]]>
        </cypherquery>
    </changeset>
</changelog>
