<?xml version="1.0" encoding="UTF-8"?>
<changelog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  
    <changeset id="NR-1014_add_distribution_content_profile_gtavarez:1" author="npatel">
        <cypherquery>
            MATCH (identity:Identity {email: 'gtavarez@theorchard.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: 'Gregory DistributionProfile',
                uuid: apoc.create.uuid(),
                roles: ['manage_nr_deliveries'],
                fullCatalogAccess: true
            })
            MERGE (identity)-[:HAS_PROFILE]->(profile)
            WITH profile
            MATCH (v:Vendor {id: '*'})
            MERGE (profile)-[:HAS_ACCESS_TO]->(v)
            RETURN profile.profileId
        </cypherquery>
    </changeset>
  
    <changeset id="NR-1014_add_distribution_content_profile_gtavarez:2" author="npatel">
        <cypherquery>
            MATCH (identity:Identity {email: 'gtavarez@theorchard.com'})-[:HAS_PROFILE]->(profile:Profile)
            WHERE profile.profileType = 'ContentProfile'
            SET 
                profile.roles = ['review_digital_audio', 'manage_nr_repertoire']
            RETURN profile.profileId
        </cypherquery>
    </changeset>
  
</changelog>
