--liquibase formatted cypher --changeset amerkulov:TAP-3576-create_abacus_profile:1 UNWIND [ 'c083e491-9f2b-4def-a92d-f481cae753f1' // andy.coyotl@theorchard.com ] AS identity_id MATCH (v:Vendor {id: "*"}) MATCH (i:Identity {id: identity_id}) MERGE (increment:IncrementId {nodeName: 'Profile'}) ON CREATE SET increment.id = 1 WITH i, v, increment CALL apoc.atomic.add(increment, 'id', 1, 3) YIELD newValue as profileId WITH i, v, profileId CREATE (p:Profile { profileId: toInteger(profileId), profileType: 'AbacusProfile', profileName: i.name, uuid: apoc.create.uuid(), roles: ['administrator'], fullCatalogAccess: true, brand: 'orchard', createdAt: datetime(), lastModifiedAt: datetime(), createdBy: 'database/TAP-3576-create_abacus_profile/5d3d6c29-d11a-43d2-9221-ad31a64b68ff:1', lastModifiedBy: 'database/TAP-3576-create_abacus_profile/5d3d6c29-d11a-43d2-9221-ad31a64b68ff:1' }) MERGE (i)-[:HAS_PROFILE]->(p) MERGE (p)-[:HAS_ACCESS_TO]->(v) RETURN i,p;