diff --git a/.changeset/thick-dogs-provide.md b/.changeset/thick-dogs-provide.md deleted file mode 100644 index 94420920b6..0000000000 --- a/.changeset/thick-dogs-provide.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@neo4j/graphql": major ---- - -When performing a `connect` operation, new relationships are always created. diff --git a/packages/graphql/src/translate/create-connect-and-params.test.ts b/packages/graphql/src/translate/create-connect-and-params.test.ts index 403bed110f..47b2994c5b 100644 --- a/packages/graphql/src/translate/create-connect-and-params.test.ts +++ b/packages/graphql/src/translate/create-connect-and-params.test.ts @@ -138,7 +138,7 @@ describe("createConnectAndParams", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this0_node - CREATE (this)-[:\`SIMILAR\`]->(this0_node) + MERGE (this)-[:\`SIMILAR\`]->(this0_node) } } WITH this, this0_node @@ -153,7 +153,7 @@ describe("createConnectAndParams", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0_node UNWIND connectedNodes as this0_node_similarMovies0_node - CREATE (this0_node)-[:\`SIMILAR\`]->(this0_node_similarMovies0_node) + MERGE (this0_node)-[:\`SIMILAR\`]->(this0_node_similarMovies0_node) } } WITH this, this0_node, this0_node_similarMovies0_node diff --git a/packages/graphql/src/translate/create-connect-and-params.ts b/packages/graphql/src/translate/create-connect-and-params.ts index d1b116c433..abae9e5db2 100644 --- a/packages/graphql/src/translate/create-connect-and-params.ts +++ b/packages/graphql/src/translate/create-connect-and-params.ts @@ -33,6 +33,7 @@ import { asArray } from "../utils/utils"; import { checkAuthentication } from "./authorization/check-authentication"; import { createAuthorizationAfterAndParams } from "./authorization/compatibility/create-authorization-after-and-params"; import { createAuthorizationBeforeAndParams } from "./authorization/compatibility/create-authorization-before-and-params"; +import { createRelationshipValidationString } from "./create-relationship-validation-string"; import { createSetRelationshipProperties } from "./create-set-relationship-properties"; import { filterMetaVariable } from "./subscriptions/filter-meta-variable"; import { createWhereNodePredicate } from "./where/create-where-predicate"; @@ -58,6 +59,7 @@ function createConnectAndParams({ callbackBucket, labelOverride, parentNode, + includeRelationshipValidation, isFirstLevel = true, source, indexPrefix, @@ -72,6 +74,7 @@ function createConnectAndParams({ refNodes: Node[]; labelOverride?: string; parentNode: Node; + includeRelationshipValidation?: boolean; isFirstLevel?: boolean; source: "CREATE" | "UPDATE" | "CONNECT"; indexPrefix?: string; @@ -92,6 +95,7 @@ function createConnectAndParams({ const inStr = relationField.direction === "IN" ? "<-" : "-"; const outStr = relationField.direction === "OUT" ? "->" : "-"; const relTypeStr = `[${relationField.properties ? relationshipName : ""}:${relationField.type}]`; + const isOverwriteNotAllowed = connect.overwrite === false; const subquery: string[] = []; const labels = relatedNode.getLabelString(context); @@ -170,7 +174,8 @@ function createConnectAndParams({ subquery.push("\t\t\tWITH connectedNodes, parentNodes"); // subquery.push(`\t\t\tUNWIND parentNodes as ${parentVar}`); subquery.push(`\t\t\tUNWIND connectedNodes as ${nodeName}`); - subquery.push(`\t\t\tCREATE (${parentVar})${inStr}${relTypeStr}${outStr}(${nodeName})`); + const connectOperator = isOverwriteNotAllowed ? "CREATE" : "MERGE"; + subquery.push(`\t\t\t${connectOperator} (${parentVar})${inStr}${relTypeStr}${outStr}(${nodeName})`); if (relationField.properties) { const relationship = context.relationships.find( @@ -210,6 +215,31 @@ function createConnectAndParams({ const innerMetaStr = ""; + if (includeRelationshipValidation || isOverwriteNotAllowed) { + const relValidationStrs: string[] = []; + const matrixItems = [ + [parentNode, parentVar], + [relatedNode, nodeName], + ] as [Node, string][]; + + matrixItems.forEach((mi) => { + const relValidationStr = createRelationshipValidationString({ + node: mi[0], + context, + varName: mi[1], + ...(isOverwriteNotAllowed && { relationshipFieldNotOverwritable: relationField.fieldName }), + }); + if (relValidationStr) { + relValidationStrs.push(relValidationStr); + } + }); + + if (relValidationStrs.length) { + subquery.push(`\tWITH ${[...filterMetaVariable(withVars), nodeName].join(", ")}${innerMetaStr}`); + subquery.push(relValidationStrs.join("\n")); + } + } + subquery.push(`WITH ${[...filterMetaVariable(withVars), nodeName].join(", ")}${innerMetaStr}`); if (connect.connect) { @@ -245,6 +275,7 @@ function createConnectAndParams({ refNodes: [newRefNode], parentNode: relatedNode, labelOverride: relField.union ? newRefNode.name : "", + includeRelationshipValidation: true, isFirstLevel: false, source: "CONNECT", }); diff --git a/packages/graphql/src/translate/create-create-and-params.ts b/packages/graphql/src/translate/create-create-and-params.ts index a08301bb76..96cdca27bb 100644 --- a/packages/graphql/src/translate/create-create-and-params.ts +++ b/packages/graphql/src/translate/create-create-and-params.ts @@ -27,6 +27,7 @@ import { createAuthorizationAfterAndParamsField, } from "./authorization/compatibility/create-authorization-after-and-params"; import createConnectAndParams from "./create-connect-and-params"; +import { createRelationshipValidationString } from "./create-relationship-validation-string"; import { createSetRelationshipProperties } from "./create-set-relationship-properties"; import { assertNonAmbiguousUpdate } from "./utils/assert-non-ambiguous-update"; import { addCallbackAndSetParam } from "./utils/callback-utils"; @@ -56,6 +57,7 @@ function createCreateAndParams({ context, callbackBucket, withVars, + includeRelationshipValidation, topLevelNodeVariable, authorizationPrefix = [0], }: { @@ -65,6 +67,7 @@ function createCreateAndParams({ context: Neo4jGraphQLTranslationContext; callbackBucket: CallbackBucket; withVars: string[]; + includeRelationshipValidation?: boolean; topLevelNodeVariable?: string; //used to build authorization variable in auth subqueries authorizationPrefix?: number[]; @@ -141,6 +144,7 @@ function createCreateAndParams({ node: refNode, varName: nodeName, withVars: [...withVars, nodeName], + includeRelationshipValidation: false, topLevelNodeVariable, authorizationPrefix: [...authorizationPrefix, reducerIndex, createIndex, refNodeIndex], }); @@ -180,6 +184,16 @@ function createCreateAndParams({ } res.meta.authorizationPredicates.push(...authorizationPredicates); } + + const relationshipValidationStr = createRelationshipValidationString({ + node: refNode, + context, + varName: nodeName, + }); + if (relationshipValidationStr) { + res.creates.push(`WITH *`); + res.creates.push(relationshipValidationStr); + } }); } @@ -317,6 +331,15 @@ function createCreateAndParams({ params = { ...params, ...authParams }; } + if (includeRelationshipValidation) { + const str = createRelationshipValidationString({ node, context, varName }); + + if (str) { + creates.push(`WITH *`); + creates.push(str); + } + } + return { create: creates.join("\n"), params, authorizationPredicates, authorizationSubqueries }; } diff --git a/packages/graphql/src/translate/create-relationship-validation-string.ts b/packages/graphql/src/translate/create-relationship-validation-string.ts new file mode 100644 index 0000000000..d9a5171fb0 --- /dev/null +++ b/packages/graphql/src/translate/create-relationship-validation-string.ts @@ -0,0 +1,93 @@ +/* + * Copyright (c) "Neo4j" + * Neo4j Sweden AB [http://neo4j.com] + * + * This file is part of Neo4j. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import type { Node } from "../classes"; +import { RELATIONSHIP_REQUIREMENT_PREFIX } from "../constants"; +import type { Neo4jGraphQLTranslationContext } from "../types/neo4j-graphql-translation-context"; + +export function createRelationshipValidationString({ + node, + context, + varName, + relationshipFieldNotOverwritable, +}: { + node: Node; + context: Neo4jGraphQLTranslationContext; + varName: string; + relationshipFieldNotOverwritable?: string; +}): string { + const strs: string[] = []; + + node.relationFields.forEach((field) => { + const isArray = field.typeMeta.array; + const isUnionOrInterface = Boolean(field.union) || Boolean(field.interface); + if (isUnionOrInterface) { + return; + } + + const toNode = context.nodes.find((n) => n.name === field.typeMeta.name) as Node; + const inStr = field.direction === "IN" ? "<-" : "-"; + const outStr = field.direction === "OUT" ? "->" : "-"; + const relVarname = `${varName}_${field.fieldName}_${toNode.name}_unique`; + + let predicate: string; + let errorMsg: string; + let subQuery: string | undefined; + if (isArray) { + if (relationshipFieldNotOverwritable === field.fieldName) { + predicate = `c = 1`; + errorMsg = `${RELATIONSHIP_REQUIREMENT_PREFIX}${node.name}.${field.fieldName} required exactly once for a specific ${toNode.name}`; + subQuery = [ + `CALL {`, + `\tWITH ${varName}`, + `\tMATCH (${varName})${inStr}[${relVarname}:${field.type}]${outStr}(other${toNode.getLabelString( + context + )})`, + `\tWITH count(${relVarname}) as c, other`, + `\tWHERE apoc.util.validatePredicate(NOT (${predicate}), '${errorMsg}', [0])`, + `\tRETURN collect(c) AS ${relVarname}_ignored`, + `}`, + ].join("\n"); + } + } else { + predicate = `c = 1`; + errorMsg = `${RELATIONSHIP_REQUIREMENT_PREFIX}${node.name}.${field.fieldName} required exactly once`; + if (!field.typeMeta.required) { + predicate = `c <= 1`; + errorMsg = `${RELATIONSHIP_REQUIREMENT_PREFIX}${node.name}.${field.fieldName} must be less than or equal to one`; + } + + subQuery = [ + `CALL {`, + `\tWITH ${varName}`, + `\tMATCH (${varName})${inStr}[${relVarname}:${field.type}]${outStr}(${toNode.getLabelString(context)})`, + `\tWITH count(${relVarname}) as c`, + `\tWHERE apoc.util.validatePredicate(NOT (${predicate}), '${errorMsg}', [0])`, + `\tRETURN c AS ${relVarname}_ignored`, + `}`, + ].join("\n"); + } + + if (subQuery) { + strs.push(subQuery); + } + }); + + return strs.join("\n"); +} diff --git a/packages/graphql/src/translate/create-update-and-params.ts b/packages/graphql/src/translate/create-update-and-params.ts index eca27080c3..c98397b000 100644 --- a/packages/graphql/src/translate/create-update-and-params.ts +++ b/packages/graphql/src/translate/create-update-and-params.ts @@ -38,6 +38,7 @@ import createConnectAndParams from "./create-connect-and-params"; import createCreateAndParams from "./create-create-and-params"; import createDeleteAndParams from "./create-delete-and-params"; import createDisconnectAndParams from "./create-disconnect-and-params"; +import { createRelationshipValidationString } from "./create-relationship-validation-string"; import { createSetRelationshipProperties } from "./create-set-relationship-properties"; import { assertNonAmbiguousUpdate } from "./utils/assert-non-ambiguous-update"; import { addCallbackAndSetParam } from "./utils/callback-utils"; @@ -72,6 +73,7 @@ export default function createUpdateAndParams({ context, callbackBucket, parameterPrefix, + includeRelationshipValidation, }: { parentVar: string; updateInput: any; @@ -82,6 +84,7 @@ export default function createUpdateAndParams({ context: Neo4jGraphQLTranslationContext; callbackBucket: CallbackBucket; parameterPrefix: string; + includeRelationshipValidation?: boolean; }): [string, any] { let hasAppliedTimeStamps = false; @@ -302,6 +305,7 @@ export default function createUpdateAndParams({ parameterPrefix: `${parameterPrefix}.${key}${ relationField.union ? `.${refNode.name}` : "" }${relationField.typeMeta.array ? `[${index}]` : ``}.update.node`, + includeRelationshipValidation: true, }); res.params = { ...res.params, ...updateAndParams[1] }; innerUpdate.push(updateAndParams[0]); @@ -424,6 +428,7 @@ export default function createUpdateAndParams({ callbackBucket, varName: nodeName, withVars: [...withVars, nodeName], + includeRelationshipValidation: false, ...createNodeInput, }); subquery.push(nestedCreate); @@ -459,6 +464,16 @@ export default function createUpdateAndParams({ subquery.push( ...getAuthorizationStatements(authorizationPredicates, authorizationSubqueries) ); + + const relationshipValidationStr = createRelationshipValidationString({ + node: refNode, + context, + varName: nodeName, + }); + if (relationshipValidationStr) { + subquery.push(`WITH ${[...withVars, nodeName].join(", ")}`); + subquery.push(relationshipValidationStr); + } }); } @@ -609,6 +624,11 @@ export default function createUpdateAndParams({ const preUpdatePredicates = authorizationBeforeStrs; + const preArrayMethodValidationStr = ""; + const relationshipValidationStr = includeRelationshipValidation + ? createRelationshipValidationString({ node, context, varName }) + : ""; + if (meta.preArrayMethodValidationStrs.length) { const nullChecks = meta.preArrayMethodValidationStrs.map((validationStr) => `${validationStr[0]} IS NULL`); const propertyNames = meta.preArrayMethodValidationStrs.map((validationStr) => validationStr[1]); @@ -648,7 +668,16 @@ export default function createUpdateAndParams({ const statements = strs; - return [[preUpdatePredicatesStr, ...statements, authorizationAfterStr].join("\n"), params]; + return [ + [ + preUpdatePredicatesStr, + preArrayMethodValidationStr, + ...statements, + authorizationAfterStr, + ...(relationshipValidationStr ? [withStr, relationshipValidationStr] : []), + ].join("\n"), + params, + ]; } function validateNonNullProperty(res: Res, varName: string, field: BaseField) { diff --git a/packages/graphql/src/translate/translate-create.ts b/packages/graphql/src/translate/translate-create.ts index 9c5b852971..ba2b10814f 100644 --- a/packages/graphql/src/translate/translate-create.ts +++ b/packages/graphql/src/translate/translate-create.ts @@ -84,6 +84,7 @@ export default async function translateCreate({ context, varName, withVars, + includeRelationshipValidation: true, topLevelNodeVariable: varName, callbackBucket, }); diff --git a/packages/graphql/src/translate/translate-update.ts b/packages/graphql/src/translate/translate-update.ts index 33e86d05f3..448c0952c3 100644 --- a/packages/graphql/src/translate/translate-update.ts +++ b/packages/graphql/src/translate/translate-update.ts @@ -29,6 +29,7 @@ import createConnectAndParams from "./create-connect-and-params"; import createCreateAndParams from "./create-create-and-params"; import createDeleteAndParams from "./create-delete-and-params"; import createDisconnectAndParams from "./create-disconnect-and-params"; +import { createRelationshipValidationString } from "./create-relationship-validation-string"; import { createSetRelationshipProperties } from "./create-set-relationship-properties"; import createUpdateAndParams from "./create-update-and-params"; import { QueryASTContext, QueryASTEnv } from "./queryAST/ast/QueryASTContext"; @@ -61,6 +62,7 @@ export default async function translateUpdate({ const disconnectStrs: string[] = []; const createStrs: string[] = []; let deleteStr = ""; + const assumeReconnecting = Boolean(connectInput) && Boolean(disconnectInput); const matchNode = new Cypher.NamedNode(varName); const where = resolveTree.args.where as GraphQLWhereArg | undefined; const matchPattern = new Cypher.Pattern(matchNode, { labels: node.getLabels(context) }); @@ -170,6 +172,7 @@ export default async function translateUpdate({ parentVar: varName, withVars, parameterPrefix: `${resolveTree.name}.args.update`, + includeRelationshipValidation: false, }); [updateStr] = updateAndParams; cypherParams = { @@ -234,6 +237,7 @@ export default async function translateUpdate({ withVars, parentNode: node, labelOverride: "", + includeRelationshipValidation: !!assumeReconnecting, source: "UPDATE", }); connectStrs.push(connectAndParams[0]); @@ -348,6 +352,7 @@ export default async function translateUpdate({ input: create.node, varName: nodeName, withVars: [...withVars, nodeName], + includeRelationshipValidation: false, }); createStrs.push(nestedCreate); cypherParams = { ...cypherParams, ...params }; @@ -406,6 +411,8 @@ export default async function translateUpdate({ ? Cypher.utils.concat(...queryASTResult.clauses) : new Cypher.Return(new Cypher.Literal("Query cannot conclude with CALL")); + const relationshipValidationStr = createRelationshipValidationString({ node, context, varName }); + const updateQuery = new Cypher.Raw((env) => { const cypher = [ matchAndWhereStr, @@ -423,6 +430,7 @@ export default async function translateUpdate({ ? [`WITH *`] : []), // When FOREACH is the last line of update 'Neo4jError: WITH is required between FOREACH and CALL' + ...(relationshipValidationStr ? [`WITH *`, relationshipValidationStr] : []), ...connectionStrs, ...interfaceStrs, compileCypher(projectionStatements, env), diff --git a/packages/graphql/tests/integration/interfaces/relationships/create/connect.int.test.ts b/packages/graphql/tests/integration/interfaces/relationships/create/connect.int.test.ts index 012b4a17ce..7378938d71 100644 --- a/packages/graphql/tests/integration/interfaces/relationships/create/connect.int.test.ts +++ b/packages/graphql/tests/integration/interfaces/relationships/create/connect.int.test.ts @@ -76,7 +76,7 @@ describe("interface relationships", () => { await testHelper.close(); }); - test("create->connect->connect should connect using interface relationship fields", async () => { + test("should nested create connect using interface relationship fields", async () => { const actorName1 = generate({ readable: true, charset: "alphabetic", @@ -163,97 +163,4 @@ describe("interface relationships", () => { }, }); }); - - test("create->connect->connect should create a new relationship using interface relationship fields", async () => { - const actorName1 = generate({ - readable: true, - charset: "alphabetic", - }); - const actorName2 = generate({ - readable: true, - charset: "alphabetic", - }); - - const movieTitle = generate({ - readable: true, - charset: "alphabetic", - }); - const movieRuntime = 20340; - const movieScreenTime = 87163; - - const query = ` - mutation CreateActorConnectMovie($name1: String!, $title: String, $screenTime: Int!, $name2: String) { - ${Actor.operations.create}( - input: [ - { - name: $name1 - actedIn: { - connect: { - edge: { screenTime: $screenTime } - where: { node: { title_EQ: $title } } - connect: { - actors: { edge: { ActedIn: { screenTime: $screenTime } }, where: { node: { name_EQ: $name2 } } } - } - } - } - } - ] - ) { - ${Actor.plural} { - name - actedIn { - title - actors { - name - } - ... on ${Movie} { - runtime - } - } - } - } - } - `; - - await testHelper.executeCypher( - ` - CREATE (m:${Movie} { title: $movieTitle, runtime:$movieRuntime }) - CREATE (:${Actor} { name: $name })-[:ACTED_IN { screenTime: $movieScreenTime }]->(m) - - `, - { movieTitle, movieRuntime, name: actorName2, movieScreenTime } - ); - - const gqlResult = await testHelper.executeGraphQL(query, { - variableValues: { - name1: actorName1, - title: movieTitle, - screenTime: movieScreenTime, - name2: actorName2, - }, - }); - - expect(gqlResult.errors).toBeFalsy(); - - expect(gqlResult.data).toEqual({ - [Actor.operations.create]: { - [Actor.plural]: [ - { - actedIn: [ - { - runtime: movieRuntime, - title: movieTitle, - actors: expect.toIncludeSameMembers([ - { name: actorName2 }, - { name: actorName1 }, - { name: actorName2 }, - ]), - }, - ], - name: actorName1, - }, - ], - }, - }); - }); }); diff --git a/packages/graphql/tests/integration/interfaces/relationships/declare-relationship/interface-simple.int.test.ts b/packages/graphql/tests/integration/interfaces/relationships/declare-relationship/interface-simple.int.test.ts index d97cf17b06..c33f799bf3 100644 --- a/packages/graphql/tests/integration/interfaces/relationships/declare-relationship/interface-simple.int.test.ts +++ b/packages/graphql/tests/integration/interfaces/relationships/declare-relationship/interface-simple.int.test.ts @@ -1451,36 +1451,22 @@ describe("interface with declared relationships", () => { edges: expect.toIncludeSameMembers([ { node: { - title: movieTitle, + title: movieTitle2, actorsConnection: { edges: expect.toIncludeSameMembers([ { node: { - name: actorName3, - actedInConnection: { - edges: expect.toIncludeSameMembers([ - { - node: { title: movieTitle, runtime: movieRuntime }, - properties: { screenTime: 111 }, - }, - ]), - }, - }, - properties: { screenTime: 111 }, - }, - { - node: { - name: actorName3, + name: actorName2, actedInConnection: { edges: expect.toIncludeSameMembers([ { - node: { title: movieTitle, runtime: movieRuntime }, - properties: { screenTime: 111 }, + node: { title: movieTitle2, runtime: movieRuntime }, + properties: { screenTime: movieScreenTime }, }, ]), }, }, - properties: { screenTime: 111 }, + properties: { screenTime: movieScreenTime }, }, { node: { @@ -1513,22 +1499,22 @@ describe("interface with declared relationships", () => { }, { node: { - title: movieTitle2, + title: movieTitle, actorsConnection: { - edges: expect.toIncludeSameMembers([ + edges: [ { node: { - name: actorName2, + name: actorName3, actedInConnection: { - edges: expect.toIncludeSameMembers([ + edges: [ { - node: { title: movieTitle2, runtime: movieRuntime }, - properties: { screenTime: movieScreenTime }, + node: { title: movieTitle, runtime: movieRuntime }, + properties: { screenTime: 111 }, }, - ]), + ], }, }, - properties: { screenTime: movieScreenTime }, + properties: { screenTime: 111 }, }, { node: { @@ -1555,7 +1541,7 @@ describe("interface with declared relationships", () => { }, properties: { screenTime: movieScreenTime }, }, - ]), + ], }, }, }, @@ -1674,20 +1660,6 @@ describe("interface with declared relationships", () => { }, properties: { screenTime: 111 }, }, - { - node: { - name: actorName3, - actedInConnection: { - edges: expect.toIncludeSameMembers([ - { - node: { title: movieTitle, runtime: movieRuntime }, - properties: { screenTime: 111 }, - }, - ]), - }, - }, - properties: { screenTime: 111 }, - }, { node: { name: actorName, @@ -1740,8 +1712,9 @@ describe("interface with declared relationships", () => { edge: { screenTime: 112 } where: { node: { title_EQ: "${movieTitle}" } } connect: { - actors: [{ + actors: [{ edge: { ActedIn: { screenTime: 111 }, StarredIn: { episodeNr: 111 } }, + }] } }] @@ -1819,20 +1792,6 @@ describe("interface with declared relationships", () => { title: movieTitle, actorsConnection: { edges: expect.toIncludeSameMembers([ - { - node: { - name: actorName, - actedInConnection: { - edges: expect.toIncludeSameMembers([ - { - node: { title: movieTitle, runtime: movieRuntime }, - properties: { screenTime: 111 }, - }, - ]), - }, - }, - properties: { screenTime: 111 }, - }, { node: { name: actorName2, @@ -1842,10 +1801,6 @@ describe("interface with declared relationships", () => { node: { title: movieTitle, runtime: movieRuntime }, properties: { screenTime: 111 }, }, - { - node: { title: movieTitle, runtime: movieRuntime }, - properties: { screenTime: 112 }, - }, ]), }, }, @@ -1853,21 +1808,17 @@ describe("interface with declared relationships", () => { }, { node: { - name: actorName2, + name: actorName, actedInConnection: { - edges: expect.toIncludeSameMembers([ + edges: [ { node: { title: movieTitle, runtime: movieRuntime }, properties: { screenTime: 111 }, }, - { - node: { title: movieTitle, runtime: movieRuntime }, - properties: { screenTime: 112 }, - }, - ]), + ], }, }, - properties: { screenTime: 112 }, + properties: { screenTime: 111 }, }, ]), }, diff --git a/packages/graphql/tests/integration/relationship-properties/connect-union.int.test.ts b/packages/graphql/tests/integration/relationship-properties/connect-union.int.test.ts index cafc808b7a..7e7f220b10 100644 --- a/packages/graphql/tests/integration/relationship-properties/connect-union.int.test.ts +++ b/packages/graphql/tests/integration/relationship-properties/connect-union.int.test.ts @@ -170,58 +170,4 @@ describe("Relationship properties - connect on union", () => { const neo4jResult = await testHelper.executeCypher(cypher, { movieTitle, screenTime, actorName }); expect(neo4jResult.records).toHaveLength(1); }); - - test("should update an actor while connecting an existing relationship that has properties(with Union)", async () => { - const movieTitle = generate({ charset: "alphabetic" }); - const actorName = generate({ charset: "alphabetic" }); - const screenTime = Math.floor((Math.random() * 1e3) / Math.random()); - - const source = /* GraphQL */ ` - mutation($movieTitle: String!, $screenTime: Int!, $actorName: String!) { - ${Actor.operations.update}( - where: { name_EQ: $actorName } - update: { - actedIn: { - ${Movie}: { - connect: { - where: { node: { title_EQ: $movieTitle } } - edge: { screenTime: $screenTime } - } - } - } - } - ) { - ${Actor.plural} { - name - } - } - } - `; - - await testHelper.executeCypher( - ` - CREATE (:${Movie} {title:$movieTitle}) - CREATE (:${Actor} {name:$actorName})-[:ACTED_IN {screenTime: 0}]->(:${Movie} {title: $movieTitle}) - `, - { movieTitle, actorName } - ); - - const gqlResult = await testHelper.executeGraphQL(source, { - variableValues: { movieTitle, actorName, screenTime }, - }); - expect(gqlResult.errors).toBeFalsy(); - expect((gqlResult.data as any)[Actor.operations.update][Actor.plural]).toEqual([ - { - name: actorName, - }, - ]); - - const cypher = ` - MATCH (a:${Actor} {name: $actorName})-[:ACTED_IN {screenTime: $screenTime}]->(:${Movie} {title: $movieTitle}) - RETURN a - `; - - const neo4jResult = await testHelper.executeCypher(cypher, { movieTitle, screenTime, actorName }); - expect(neo4jResult.records).toHaveLength(2); - }); }); diff --git a/packages/graphql/tests/integration/update.int.test.ts b/packages/graphql/tests/integration/update.int.test.ts index cba715ba39..9ed464be8a 100644 --- a/packages/graphql/tests/integration/update.int.test.ts +++ b/packages/graphql/tests/integration/update.int.test.ts @@ -134,7 +134,6 @@ describe("update (deprecate implicit _SET)", () => { expect(gqlResult?.data?.[Movie.operations.update]).toEqual({ [Movie.plural]: [{ id, name: updatedName }] }); }); - test("should connect through interface relationship", async () => { const typeDefs = /* GraphQL */ ` type ${Movie} implements Production @subscription(events: []) @node { @@ -218,7 +217,7 @@ describe("update (deprecate implicit _SET)", () => { ` ); - expect(cypherResult.records).toHaveLength(2); + expect(cypherResult.records).toHaveLength(1); expect(gqlResult?.data?.[Movie.operations.update]).toEqual({ [Movie.plural]: [{ id: "1", title: "Movie1" }], diff --git a/packages/graphql/tests/tck/connections/relationship_properties/connect.test.ts b/packages/graphql/tests/tck/connections/relationship_properties/connect.test.ts index 710b97e558..778aba2020 100644 --- a/packages/graphql/tests/tck/connections/relationship_properties/connect.test.ts +++ b/packages/graphql/tests/tck/connections/relationship_properties/connect.test.ts @@ -84,7 +84,7 @@ describe("Relationship Properties Connect Cypher", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actors_connect0_node - CREATE (this0)<-[this0_actors_connect0_relationship:ACTED_IN]-(this0_actors_connect0_node) + MERGE (this0)<-[this0_actors_connect0_relationship:ACTED_IN]-(this0_actors_connect0_node) SET this0_actors_connect0_relationship.screenTime = $this0_actors_connect0_relationship_screenTime } } @@ -173,7 +173,7 @@ describe("Relationship Properties Connect Cypher", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actors_connect0_node - CREATE (this0)<-[this0_actors_connect0_relationship:ACTED_IN]-(this0_actors_connect0_node) + MERGE (this0)<-[this0_actors_connect0_relationship:ACTED_IN]-(this0_actors_connect0_node) SET this0_actors_connect0_relationship.screenTime = $this0_actors_connect0_relationship_screenTime } } @@ -255,7 +255,7 @@ describe("Relationship Properties Connect Cypher", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actors0_connect0_node - CREATE (this)<-[this_actors0_connect0_relationship:ACTED_IN]-(this_actors0_connect0_node) + MERGE (this)<-[this_actors0_connect0_relationship:ACTED_IN]-(this_actors0_connect0_node) SET this_actors0_connect0_relationship.screenTime = $this_actors0_connect0_relationship_screenTime } } @@ -334,7 +334,7 @@ describe("Relationship Properties Connect Cypher", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actors0_connect0_node - CREATE (this)<-[this_actors0_connect0_relationship:ACTED_IN]-(this_actors0_connect0_node) + MERGE (this)<-[this_actors0_connect0_relationship:ACTED_IN]-(this_actors0_connect0_node) SET this_actors0_connect0_relationship.screenTime = $this_actors0_connect0_relationship_screenTime } } diff --git a/packages/graphql/tests/tck/directives/authorization/arguments/allow/allow.test.ts b/packages/graphql/tests/tck/directives/authorization/arguments/allow/allow.test.ts index 7fff0e367e..6951c9af5f 100644 --- a/packages/graphql/tests/tck/directives/authorization/arguments/allow/allow.test.ts +++ b/packages/graphql/tests/tck/directives/authorization/arguments/allow/allow.test.ts @@ -797,7 +797,7 @@ describe("Cypher Auth Allow", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_posts0_connect0_node - CREATE (this)-[:HAS_POST]->(this_posts0_connect0_node) + MERGE (this)-[:HAS_POST]->(this_posts0_connect0_node) } } WITH this, this_posts0_connect0_node diff --git a/packages/graphql/tests/tck/directives/authorization/arguments/roles-where.test.ts b/packages/graphql/tests/tck/directives/authorization/arguments/roles-where.test.ts index 327a8b64ac..922816728b 100644 --- a/packages/graphql/tests/tck/directives/authorization/arguments/roles-where.test.ts +++ b/packages/graphql/tests/tck/directives/authorization/arguments/roles-where.test.ts @@ -844,7 +844,7 @@ describe("Cypher Auth Where with Roles", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_posts_connect0_node - CREATE (this0)-[:HAS_POST]->(this0_posts_connect0_node) + MERGE (this0)-[:HAS_POST]->(this0_posts_connect0_node) } } WITH this0, this0_posts_connect0_node @@ -929,7 +929,7 @@ describe("Cypher Auth Where with Roles", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_posts_connect0_node - CREATE (this0)-[:HAS_POST]->(this0_posts_connect0_node) + MERGE (this0)-[:HAS_POST]->(this0_posts_connect0_node) } } WITH this0, this0_posts_connect0_node @@ -1004,7 +1004,7 @@ describe("Cypher Auth Where with Roles", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_posts0_connect0_node - CREATE (this)-[:HAS_POST]->(this_posts0_connect0_node) + MERGE (this)-[:HAS_POST]->(this_posts0_connect0_node) } } WITH this, this_posts0_connect0_node @@ -1077,7 +1077,7 @@ describe("Cypher Auth Where with Roles", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_posts0_connect0_node - CREATE (this)-[:HAS_POST]->(this_posts0_connect0_node) + MERGE (this)-[:HAS_POST]->(this_posts0_connect0_node) } } WITH this, this_posts0_connect0_node diff --git a/packages/graphql/tests/tck/directives/authorization/arguments/roles/roles.test.ts b/packages/graphql/tests/tck/directives/authorization/arguments/roles/roles.test.ts index 60aba16f9d..a86985b7a9 100644 --- a/packages/graphql/tests/tck/directives/authorization/arguments/roles/roles.test.ts +++ b/packages/graphql/tests/tck/directives/authorization/arguments/roles/roles.test.ts @@ -452,7 +452,7 @@ describe("Cypher Auth Roles", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_posts0_connect0_node - CREATE (this)-[:HAS_POST]->(this_posts0_connect0_node) + MERGE (this)-[:HAS_POST]->(this_posts0_connect0_node) } } WITH this, this_posts0_connect0_node @@ -525,7 +525,7 @@ describe("Cypher Auth Roles", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this_post0 UNWIND connectedNodes as this_post0_creator0_connect0_node - CREATE (this_post0)-[:HAS_POST]->(this_post0_creator0_connect0_node) + MERGE (this_post0)-[:HAS_POST]->(this_post0_creator0_connect0_node) } } WITH this, this_post0, this_post0_creator0_connect0_node diff --git a/packages/graphql/tests/tck/directives/authorization/arguments/validate/validate.test.ts b/packages/graphql/tests/tck/directives/authorization/arguments/validate/validate.test.ts index 0eac6cc1d2..154429144b 100644 --- a/packages/graphql/tests/tck/directives/authorization/arguments/validate/validate.test.ts +++ b/packages/graphql/tests/tck/directives/authorization/arguments/validate/validate.test.ts @@ -392,7 +392,7 @@ describe("Cypher Auth Allow", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_creator0_connect0_node - CREATE (this)<-[:HAS_POST]-(this_creator0_connect0_node) + MERGE (this)<-[:HAS_POST]-(this_creator0_connect0_node) } } WITH this, this_creator0_connect0_node diff --git a/packages/graphql/tests/tck/directives/authorization/arguments/where/interface-relationships/implementation-where.test.ts b/packages/graphql/tests/tck/directives/authorization/arguments/where/interface-relationships/implementation-where.test.ts index 7d3fd6b2ab..a334de7810 100644 --- a/packages/graphql/tests/tck/directives/authorization/arguments/where/interface-relationships/implementation-where.test.ts +++ b/packages/graphql/tests/tck/directives/authorization/arguments/where/interface-relationships/implementation-where.test.ts @@ -627,7 +627,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_content_connect0_node - CREATE (this0)-[:HAS_CONTENT]->(this0_content_connect0_node) + MERGE (this0)-[:HAS_CONTENT]->(this0_content_connect0_node) } } WITH this0, this0_content_connect0_node @@ -644,7 +644,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_content_connect1_node - CREATE (this0)-[:HAS_CONTENT]->(this0_content_connect1_node) + MERGE (this0)-[:HAS_CONTENT]->(this0_content_connect1_node) } } WITH this0, this0_content_connect1_node @@ -717,7 +717,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_content_connect0_node - CREATE (this0)-[:HAS_CONTENT]->(this0_content_connect0_node) + MERGE (this0)-[:HAS_CONTENT]->(this0_content_connect0_node) } } WITH this0, this0_content_connect0_node @@ -734,7 +734,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_content_connect1_node - CREATE (this0)-[:HAS_CONTENT]->(this0_content_connect1_node) + MERGE (this0)-[:HAS_CONTENT]->(this0_content_connect1_node) } } WITH this0, this0_content_connect1_node @@ -801,7 +801,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_content0_connect0_node - CREATE (this)-[:HAS_CONTENT]->(this_content0_connect0_node) + MERGE (this)-[:HAS_CONTENT]->(this_content0_connect0_node) } } WITH this, this_content0_connect0_node @@ -823,7 +823,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_content0_connect0_node - CREATE (this)-[:HAS_CONTENT]->(this_content0_connect0_node) + MERGE (this)-[:HAS_CONTENT]->(this_content0_connect0_node) } } WITH this, this_content0_connect0_node @@ -883,7 +883,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_content0_connect0_node - CREATE (this)-[:HAS_CONTENT]->(this_content0_connect0_node) + MERGE (this)-[:HAS_CONTENT]->(this_content0_connect0_node) } } WITH this, this_content0_connect0_node @@ -905,7 +905,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_content0_connect0_node - CREATE (this)-[:HAS_CONTENT]->(this_content0_connect0_node) + MERGE (this)-[:HAS_CONTENT]->(this_content0_connect0_node) } } WITH this, this_content0_connect0_node diff --git a/packages/graphql/tests/tck/directives/authorization/arguments/where/where.test.ts b/packages/graphql/tests/tck/directives/authorization/arguments/where/where.test.ts index ecad081f01..24a5c02794 100644 --- a/packages/graphql/tests/tck/directives/authorization/arguments/where/where.test.ts +++ b/packages/graphql/tests/tck/directives/authorization/arguments/where/where.test.ts @@ -801,7 +801,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_posts_connect0_node - CREATE (this0)-[:HAS_POST]->(this0_posts_connect0_node) + MERGE (this0)-[:HAS_POST]->(this0_posts_connect0_node) } } WITH this0, this0_posts_connect0_node @@ -876,7 +876,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_posts_connect0_node - CREATE (this0)-[:HAS_POST]->(this0_posts_connect0_node) + MERGE (this0)-[:HAS_POST]->(this0_posts_connect0_node) } } WITH this0, this0_posts_connect0_node @@ -941,7 +941,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_posts0_connect0_node - CREATE (this)-[:HAS_POST]->(this_posts0_connect0_node) + MERGE (this)-[:HAS_POST]->(this_posts0_connect0_node) } } WITH this, this_posts0_connect0_node @@ -998,7 +998,7 @@ describe("Cypher Auth Where", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_posts0_connect0_node - CREATE (this)-[:HAS_POST]->(this_posts0_connect0_node) + MERGE (this)-[:HAS_POST]->(this_posts0_connect0_node) } } WITH this, this_posts0_connect0_node diff --git a/packages/graphql/tests/tck/directives/cypher/filtering/cypher-filtering-connect.test.ts b/packages/graphql/tests/tck/directives/cypher/filtering/cypher-filtering-connect.test.ts index ab4fdd9e6c..34d4e800a4 100644 --- a/packages/graphql/tests/tck/directives/cypher/filtering/cypher-filtering-connect.test.ts +++ b/packages/graphql/tests/tck/directives/cypher/filtering/cypher-filtering-connect.test.ts @@ -119,7 +119,7 @@ describe("cypher directive filtering", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actors_connect0_node - CREATE (this0)<-[:ACTED_IN]-(this0_actors_connect0_node) + MERGE (this0)<-[:ACTED_IN]-(this0_actors_connect0_node) } } WITH this0, this0_actors_connect0_node diff --git a/packages/graphql/tests/tck/directives/interface-relationships/create/connect.test.ts b/packages/graphql/tests/tck/directives/interface-relationships/create/connect.test.ts index bb663b9da8..b8352c8913 100644 --- a/packages/graphql/tests/tck/directives/interface-relationships/create/connect.test.ts +++ b/packages/graphql/tests/tck/directives/interface-relationships/create/connect.test.ts @@ -102,7 +102,7 @@ describe("Interface Relationships - Create connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actedIn_connect0_node - CREATE (this0)-[this0_actedIn_connect0_relationship:ACTED_IN]->(this0_actedIn_connect0_node) + MERGE (this0)-[this0_actedIn_connect0_relationship:ACTED_IN]->(this0_actedIn_connect0_node) SET this0_actedIn_connect0_relationship.screenTime = $this0_actedIn_connect0_relationship_screenTime } } @@ -120,7 +120,7 @@ describe("Interface Relationships - Create connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actedIn_connect1_node - CREATE (this0)-[this0_actedIn_connect1_relationship:ACTED_IN]->(this0_actedIn_connect1_node) + MERGE (this0)-[this0_actedIn_connect1_relationship:ACTED_IN]->(this0_actedIn_connect1_node) SET this0_actedIn_connect1_relationship.screenTime = $this0_actedIn_connect1_relationship_screenTime } } diff --git a/packages/graphql/tests/tck/directives/interface-relationships/update/connect.test.ts b/packages/graphql/tests/tck/directives/interface-relationships/update/connect.test.ts index 5c44528110..2f5bcf11ce 100644 --- a/packages/graphql/tests/tck/directives/interface-relationships/update/connect.test.ts +++ b/packages/graphql/tests/tck/directives/interface-relationships/update/connect.test.ts @@ -94,7 +94,7 @@ describe("Interface Relationships - Update connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actedIn0_connect0_node - CREATE (this)-[this_actedIn0_connect0_relationship:ACTED_IN]->(this_actedIn0_connect0_node) + MERGE (this)-[this_actedIn0_connect0_relationship:ACTED_IN]->(this_actedIn0_connect0_node) SET this_actedIn0_connect0_relationship.screenTime = $this_actedIn0_connect0_relationship_screenTime } } @@ -117,7 +117,7 @@ describe("Interface Relationships - Update connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actedIn0_connect0_node - CREATE (this)-[this_actedIn0_connect0_relationship:ACTED_IN]->(this_actedIn0_connect0_node) + MERGE (this)-[this_actedIn0_connect0_relationship:ACTED_IN]->(this_actedIn0_connect0_node) SET this_actedIn0_connect0_relationship.screenTime = $this_actedIn0_connect0_relationship_screenTime } } @@ -186,7 +186,7 @@ describe("Interface Relationships - Update connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actedIn0_connect0_node - CREATE (this)-[this_actedIn0_connect0_relationship:ACTED_IN]->(this_actedIn0_connect0_node) + MERGE (this)-[this_actedIn0_connect0_relationship:ACTED_IN]->(this_actedIn0_connect0_node) SET this_actedIn0_connect0_relationship.screenTime = $this_actedIn0_connect0_relationship_screenTime } } @@ -202,7 +202,7 @@ describe("Interface Relationships - Update connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this_actedIn0_connect0_node UNWIND connectedNodes as this_actedIn0_connect0_node_actors0_node - CREATE (this_actedIn0_connect0_node)<-[this_actedIn0_connect0_node_actors0_relationship:ACTED_IN]-(this_actedIn0_connect0_node_actors0_node) + MERGE (this_actedIn0_connect0_node)<-[this_actedIn0_connect0_node_actors0_relationship:ACTED_IN]-(this_actedIn0_connect0_node_actors0_node) SET this_actedIn0_connect0_node_actors0_relationship.screenTime = $this_actedIn0_connect0_node_actors0_relationship_ActedIn_screenTime } } @@ -227,7 +227,7 @@ describe("Interface Relationships - Update connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actedIn0_connect0_node - CREATE (this)-[this_actedIn0_connect0_relationship:ACTED_IN]->(this_actedIn0_connect0_node) + MERGE (this)-[this_actedIn0_connect0_relationship:ACTED_IN]->(this_actedIn0_connect0_node) SET this_actedIn0_connect0_relationship.screenTime = $this_actedIn0_connect0_relationship_screenTime } } @@ -243,7 +243,7 @@ describe("Interface Relationships - Update connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this_actedIn0_connect0_node UNWIND connectedNodes as this_actedIn0_connect0_node_actors0_node - CREATE (this_actedIn0_connect0_node)<-[this_actedIn0_connect0_node_actors0_relationship:ACTED_IN]-(this_actedIn0_connect0_node_actors0_node) + MERGE (this_actedIn0_connect0_node)<-[this_actedIn0_connect0_node_actors0_relationship:ACTED_IN]-(this_actedIn0_connect0_node_actors0_node) SET this_actedIn0_connect0_node_actors0_relationship.screenTime = $this_actedIn0_connect0_node_actors0_relationship_ActedIn_screenTime } } diff --git a/packages/graphql/tests/tck/directives/node/node-label.test.ts b/packages/graphql/tests/tck/directives/node/node-label.test.ts index 8f3aaf017a..18501a87b0 100644 --- a/packages/graphql/tests/tck/directives/node/node-label.test.ts +++ b/packages/graphql/tests/tck/directives/node/node-label.test.ts @@ -361,7 +361,7 @@ describe("Label in Node directive", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actors0_connect0_node - CREATE (this)<-[:ACTED_IN]-(this_actors0_connect0_node) + MERGE (this)<-[:ACTED_IN]-(this_actors0_connect0_node) } } WITH this, this_actors0_connect0_node diff --git a/packages/graphql/tests/tck/issues/1132.test.ts b/packages/graphql/tests/tck/issues/1132.test.ts index 1451ee839b..d2a2743aca 100644 --- a/packages/graphql/tests/tck/issues/1132.test.ts +++ b/packages/graphql/tests/tck/issues/1132.test.ts @@ -74,7 +74,7 @@ describe("https://github.com/neo4j/graphql/issues/1132", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_targets0_connect0_node - CREATE (this)-[:HAS_TARGET]->(this_targets0_connect0_node) + MERGE (this)-[:HAS_TARGET]->(this_targets0_connect0_node) } } WITH this, this_targets0_connect0_node diff --git a/packages/graphql/tests/tck/issues/4214.test.ts b/packages/graphql/tests/tck/issues/4214.test.ts index b748932b33..640ab3f5da 100644 --- a/packages/graphql/tests/tck/issues/4214.test.ts +++ b/packages/graphql/tests/tck/issues/4214.test.ts @@ -175,7 +175,7 @@ describe("https://github.com/neo4j/graphql/issues/4214", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_transaction_connect0_node - CREATE (this0)-[:ITEM_TRANSACTED]->(this0_transaction_connect0_node) + MERGE (this0)-[:ITEM_TRANSACTED]->(this0_transaction_connect0_node) } } WITH this0, this0_transaction_connect0_node diff --git a/packages/graphql/tests/tck/issues/4583.test.ts b/packages/graphql/tests/tck/issues/4583.test.ts index f5785892ff..1ec53fa663 100644 --- a/packages/graphql/tests/tck/issues/4583.test.ts +++ b/packages/graphql/tests/tck/issues/4583.test.ts @@ -103,7 +103,7 @@ describe("https://github.com/neo4j/graphql/issues/4583", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actedIn_connect0_node - CREATE (this0)-[this0_actedIn_connect0_relationship:ACTED_IN]->(this0_actedIn_connect0_node) + MERGE (this0)-[this0_actedIn_connect0_relationship:ACTED_IN]->(this0_actedIn_connect0_node) SET this0_actedIn_connect0_relationship.screenTime = $this0_actedIn_connect0_relationship_screenTime } } @@ -121,7 +121,7 @@ describe("https://github.com/neo4j/graphql/issues/4583", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actedIn_connect1_node - CREATE (this0)-[this0_actedIn_connect1_relationship:ACTED_IN]->(this0_actedIn_connect1_node) + MERGE (this0)-[this0_actedIn_connect1_relationship:ACTED_IN]->(this0_actedIn_connect1_node) SET this0_actedIn_connect1_relationship.screenTime = $this0_actedIn_connect1_relationship_screenTime } } @@ -196,7 +196,7 @@ describe("https://github.com/neo4j/graphql/issues/4583", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actedIn_connect0_node - CREATE (this0)-[this0_actedIn_connect0_relationship:ACTED_IN]->(this0_actedIn_connect0_node) + MERGE (this0)-[this0_actedIn_connect0_relationship:ACTED_IN]->(this0_actedIn_connect0_node) SET this0_actedIn_connect0_relationship.screenTime = $this0_actedIn_connect0_relationship_screenTime } } @@ -214,7 +214,7 @@ describe("https://github.com/neo4j/graphql/issues/4583", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actedIn_connect1_node - CREATE (this0)-[this0_actedIn_connect1_relationship:ACTED_IN]->(this0_actedIn_connect1_node) + MERGE (this0)-[this0_actedIn_connect1_relationship:ACTED_IN]->(this0_actedIn_connect1_node) SET this0_actedIn_connect1_relationship.screenTime = $this0_actedIn_connect1_relationship_screenTime } } @@ -295,7 +295,7 @@ describe("https://github.com/neo4j/graphql/issues/4583", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actedIn_connect0_node - CREATE (this0)-[this0_actedIn_connect0_relationship:ACTED_IN]->(this0_actedIn_connect0_node) + MERGE (this0)-[this0_actedIn_connect0_relationship:ACTED_IN]->(this0_actedIn_connect0_node) SET this0_actedIn_connect0_relationship.screenTime = $this0_actedIn_connect0_relationship_screenTime } } @@ -311,7 +311,7 @@ describe("https://github.com/neo4j/graphql/issues/4583", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0_actedIn_connect0_node UNWIND connectedNodes as this0_actedIn_connect0_node_actors0_node - CREATE (this0_actedIn_connect0_node)<-[this0_actedIn_connect0_node_actors0_relationship:ACTED_IN]-(this0_actedIn_connect0_node_actors0_node) + MERGE (this0_actedIn_connect0_node)<-[this0_actedIn_connect0_node_actors0_relationship:ACTED_IN]-(this0_actedIn_connect0_node_actors0_node) SET this0_actedIn_connect0_node_actors0_relationship.screenTime = $this0_actedIn_connect0_node_actors0_relationship_ActedIn_screenTime } } @@ -331,7 +331,7 @@ describe("https://github.com/neo4j/graphql/issues/4583", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actedIn_connect1_node - CREATE (this0)-[this0_actedIn_connect1_relationship:ACTED_IN]->(this0_actedIn_connect1_node) + MERGE (this0)-[this0_actedIn_connect1_relationship:ACTED_IN]->(this0_actedIn_connect1_node) SET this0_actedIn_connect1_relationship.screenTime = $this0_actedIn_connect1_relationship_screenTime } } @@ -347,7 +347,7 @@ describe("https://github.com/neo4j/graphql/issues/4583", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0_actedIn_connect1_node UNWIND connectedNodes as this0_actedIn_connect1_node_actors0_node - CREATE (this0_actedIn_connect1_node)<-[this0_actedIn_connect1_node_actors0_relationship:ACTED_IN]-(this0_actedIn_connect1_node_actors0_node) + MERGE (this0_actedIn_connect1_node)<-[this0_actedIn_connect1_node_actors0_relationship:ACTED_IN]-(this0_actedIn_connect1_node_actors0_node) SET this0_actedIn_connect1_node_actors0_relationship.episodeNr = $this0_actedIn_connect1_node_actors0_relationship_StarredIn_episodeNr } } diff --git a/packages/graphql/tests/tck/issues/832.test.ts b/packages/graphql/tests/tck/issues/832.test.ts index 60d08a087e..841485e2ec 100644 --- a/packages/graphql/tests/tck/issues/832.test.ts +++ b/packages/graphql/tests/tck/issues/832.test.ts @@ -99,7 +99,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_subjects_connect0_node - CREATE (this0)<-[:ACTED_IN]-(this0_subjects_connect0_node) + MERGE (this0)<-[:ACTED_IN]-(this0_subjects_connect0_node) } } WITH this0, this0_subjects_connect0_node @@ -116,7 +116,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_subjects_connect1_node - CREATE (this0)<-[:ACTED_IN]-(this0_subjects_connect1_node) + MERGE (this0)<-[:ACTED_IN]-(this0_subjects_connect1_node) } } WITH this0, this0_subjects_connect1_node @@ -134,7 +134,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_objects_connect0_node - CREATE (this0)-[:ACTED_IN]->(this0_objects_connect0_node) + MERGE (this0)-[:ACTED_IN]->(this0_objects_connect0_node) } } WITH this0, this0_objects_connect0_node @@ -151,7 +151,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_objects_connect1_node - CREATE (this0)-[:ACTED_IN]->(this0_objects_connect1_node) + MERGE (this0)-[:ACTED_IN]->(this0_objects_connect1_node) } } WITH this0, this0_objects_connect1_node @@ -175,7 +175,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this1 UNWIND connectedNodes as this1_subjects_connect0_node - CREATE (this1)<-[:ACTED_IN]-(this1_subjects_connect0_node) + MERGE (this1)<-[:ACTED_IN]-(this1_subjects_connect0_node) } } WITH this1, this1_subjects_connect0_node @@ -192,7 +192,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this1 UNWIND connectedNodes as this1_subjects_connect1_node - CREATE (this1)<-[:ACTED_IN]-(this1_subjects_connect1_node) + MERGE (this1)<-[:ACTED_IN]-(this1_subjects_connect1_node) } } WITH this1, this1_subjects_connect1_node @@ -210,7 +210,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this1 UNWIND connectedNodes as this1_objects_connect0_node - CREATE (this1)-[:ACTED_IN]->(this1_objects_connect0_node) + MERGE (this1)-[:ACTED_IN]->(this1_objects_connect0_node) } } WITH this1, this1_objects_connect0_node @@ -227,7 +227,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this1 UNWIND connectedNodes as this1_objects_connect1_node - CREATE (this1)-[:ACTED_IN]->(this1_objects_connect1_node) + MERGE (this1)-[:ACTED_IN]->(this1_objects_connect1_node) } } WITH this1, this1_objects_connect1_node @@ -324,7 +324,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_subjects_connect0_node - CREATE (this0)<-[:ACTED_IN]-(this0_subjects_connect0_node) + MERGE (this0)<-[:ACTED_IN]-(this0_subjects_connect0_node) } } WITH this0, this0_subjects_connect0_node @@ -341,7 +341,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_subjects_connect1_node - CREATE (this0)<-[:ACTED_IN]-(this0_subjects_connect1_node) + MERGE (this0)<-[:ACTED_IN]-(this0_subjects_connect1_node) } } WITH this0, this0_subjects_connect1_node @@ -359,7 +359,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_objects_connect0_node - CREATE (this0)-[:ACTED_IN]->(this0_objects_connect0_node) + MERGE (this0)-[:ACTED_IN]->(this0_objects_connect0_node) } } WITH this0, this0_objects_connect0_node @@ -376,7 +376,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_objects_connect1_node - CREATE (this0)-[:ACTED_IN]->(this0_objects_connect1_node) + MERGE (this0)-[:ACTED_IN]->(this0_objects_connect1_node) } } WITH this0, this0_objects_connect1_node @@ -454,7 +454,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_subjects_connect0_node - CREATE (this0)<-[:ACTED_IN]-(this0_subjects_connect0_node) + MERGE (this0)<-[:ACTED_IN]-(this0_subjects_connect0_node) } } WITH this0, this0_subjects_connect0_node @@ -471,7 +471,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_subjects_connect1_node - CREATE (this0)<-[:ACTED_IN]-(this0_subjects_connect1_node) + MERGE (this0)<-[:ACTED_IN]-(this0_subjects_connect1_node) } } WITH this0, this0_subjects_connect1_node @@ -489,7 +489,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_objects_connect0_node - CREATE (this0)-[:ACTED_IN]->(this0_objects_connect0_node) + MERGE (this0)-[:ACTED_IN]->(this0_objects_connect0_node) } } WITH this0, this0_objects_connect0_node @@ -506,7 +506,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_objects_connect1_node - CREATE (this0)-[:ACTED_IN]->(this0_objects_connect1_node) + MERGE (this0)-[:ACTED_IN]->(this0_objects_connect1_node) } } WITH this0, this0_objects_connect1_node @@ -595,7 +595,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_subjects_connect0_node - CREATE (this0)<-[:ACTED_IN]-(this0_subjects_connect0_node) + MERGE (this0)<-[:ACTED_IN]-(this0_subjects_connect0_node) } } WITH this0, this0_subjects_connect0_node @@ -612,7 +612,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_subjects_connect1_node - CREATE (this0)<-[:ACTED_IN]-(this0_subjects_connect1_node) + MERGE (this0)<-[:ACTED_IN]-(this0_subjects_connect1_node) } } WITH this0, this0_subjects_connect1_node @@ -630,7 +630,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_objects_connect0_node - CREATE (this0)-[:ACTED_IN]->(this0_objects_connect0_node) + MERGE (this0)-[:ACTED_IN]->(this0_objects_connect0_node) } } WITH this0, this0_objects_connect0_node @@ -647,7 +647,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_objects_connect1_node - CREATE (this0)-[:ACTED_IN]->(this0_objects_connect1_node) + MERGE (this0)-[:ACTED_IN]->(this0_objects_connect1_node) } } WITH this0, this0_objects_connect1_node @@ -671,7 +671,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this1 UNWIND connectedNodes as this1_subjects_connect0_node - CREATE (this1)<-[:ACTED_IN]-(this1_subjects_connect0_node) + MERGE (this1)<-[:ACTED_IN]-(this1_subjects_connect0_node) } } WITH this1, this1_subjects_connect0_node @@ -688,7 +688,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this1 UNWIND connectedNodes as this1_subjects_connect1_node - CREATE (this1)<-[:ACTED_IN]-(this1_subjects_connect1_node) + MERGE (this1)<-[:ACTED_IN]-(this1_subjects_connect1_node) } } WITH this1, this1_subjects_connect1_node @@ -706,7 +706,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this1 UNWIND connectedNodes as this1_objects_connect0_node - CREATE (this1)-[:ACTED_IN]->(this1_objects_connect0_node) + MERGE (this1)-[:ACTED_IN]->(this1_objects_connect0_node) } } WITH this1, this1_objects_connect0_node @@ -723,7 +723,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this1 UNWIND connectedNodes as this1_objects_connect1_node - CREATE (this1)-[:ACTED_IN]->(this1_objects_connect1_node) + MERGE (this1)-[:ACTED_IN]->(this1_objects_connect1_node) } } WITH this1, this1_objects_connect1_node @@ -881,7 +881,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_subjects_connect0_node - CREATE (this0)<-[:ACTED_IN]-(this0_subjects_connect0_node) + MERGE (this0)<-[:ACTED_IN]-(this0_subjects_connect0_node) } } WITH this0, this0_subjects_connect0_node @@ -898,7 +898,7 @@ describe("https://github.com/neo4j/graphql/issues/832", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_subjects_connect1_node - CREATE (this0)<-[:ACTED_IN]-(this0_subjects_connect1_node) + MERGE (this0)<-[:ACTED_IN]-(this0_subjects_connect1_node) } } WITH this0, this0_subjects_connect1_node diff --git a/packages/graphql/tests/tck/issues/894.test.ts b/packages/graphql/tests/tck/issues/894.test.ts index ee8cd040b0..b0664ca968 100644 --- a/packages/graphql/tests/tck/issues/894.test.ts +++ b/packages/graphql/tests/tck/issues/894.test.ts @@ -92,7 +92,7 @@ describe("https://github.com/neo4j/graphql/issues/894", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_activeOrganization0_connect0_node - CREATE (this)-[:ACTIVELY_MANAGING]->(this_activeOrganization0_connect0_node) + MERGE (this)-[:ACTIVELY_MANAGING]->(this_activeOrganization0_connect0_node) } } WITH this, this_activeOrganization0_connect0_node diff --git a/packages/graphql/tests/tck/nested-unions.test.ts b/packages/graphql/tests/tck/nested-unions.test.ts index fcfa2d51a6..576ee4d1e1 100644 --- a/packages/graphql/tests/tck/nested-unions.test.ts +++ b/packages/graphql/tests/tck/nested-unions.test.ts @@ -106,7 +106,7 @@ describe("Nested Unions", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actors_LeadActor0_connect0_node - CREATE (this)<-[:ACTED_IN]-(this_actors_LeadActor0_connect0_node) + MERGE (this)<-[:ACTED_IN]-(this_actors_LeadActor0_connect0_node) } } WITH this, this_actors_LeadActor0_connect0_node @@ -121,7 +121,7 @@ describe("Nested Unions", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this_actors_LeadActor0_connect0_node UNWIND connectedNodes as this_actors_LeadActor0_connect0_node_actedIn_Series0_node - CREATE (this_actors_LeadActor0_connect0_node)-[:ACTED_IN]->(this_actors_LeadActor0_connect0_node_actedIn_Series0_node) + MERGE (this_actors_LeadActor0_connect0_node)-[:ACTED_IN]->(this_actors_LeadActor0_connect0_node_actedIn_Series0_node) } } WITH this, this_actors_LeadActor0_connect0_node, this_actors_LeadActor0_connect0_node_actedIn_Series0_node diff --git a/packages/graphql/tests/tck/operations/batch/batch-create-interface.test.ts b/packages/graphql/tests/tck/operations/batch/batch-create-interface.test.ts index fb2bdba7ae..ffb715e710 100644 --- a/packages/graphql/tests/tck/operations/batch/batch-create-interface.test.ts +++ b/packages/graphql/tests/tck/operations/batch/batch-create-interface.test.ts @@ -305,7 +305,7 @@ describe("Batch Create, Interface", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this3 UNWIND connectedNodes as this3_workers_connect0_node - CREATE (this3)<-[this3_workers_connect0_relationship:EMPLOYED]-(this3_workers_connect0_node) + MERGE (this3)<-[this3_workers_connect0_relationship:EMPLOYED]-(this3_workers_connect0_node) } } WITH this3, this3_workers_connect0_node @@ -322,7 +322,7 @@ describe("Batch Create, Interface", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this3 UNWIND connectedNodes as this3_workers_connect1_node - CREATE (this3)<-[this3_workers_connect1_relationship:EMPLOYED]-(this3_workers_connect1_node) + MERGE (this3)<-[this3_workers_connect1_relationship:EMPLOYED]-(this3_workers_connect1_node) } } WITH this3, this3_workers_connect1_node diff --git a/packages/graphql/tests/tck/operations/batch/batch-create.test.ts b/packages/graphql/tests/tck/operations/batch/batch-create.test.ts index a64e2a5258..49d1f138ff 100644 --- a/packages/graphql/tests/tck/operations/batch/batch-create.test.ts +++ b/packages/graphql/tests/tck/operations/batch/batch-create.test.ts @@ -348,7 +348,7 @@ describe("Batch Create", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actors_connect0_node - CREATE (this0)<-[this0_actors_connect0_relationship:ACTED_IN]-(this0_actors_connect0_node) + MERGE (this0)<-[this0_actors_connect0_relationship:ACTED_IN]-(this0_actors_connect0_node) } } WITH this0, this0_actors_connect0_node @@ -371,7 +371,7 @@ describe("Batch Create", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this1 UNWIND connectedNodes as this1_actors_connect0_node - CREATE (this1)<-[this1_actors_connect0_relationship:ACTED_IN]-(this1_actors_connect0_node) + MERGE (this1)<-[this1_actors_connect0_relationship:ACTED_IN]-(this1_actors_connect0_node) } } WITH this1, this1_actors_connect0_node diff --git a/packages/graphql/tests/tck/operations/connect.test.ts b/packages/graphql/tests/tck/operations/connect.test.ts index 65edbedc83..8c701c1400 100644 --- a/packages/graphql/tests/tck/operations/connect.test.ts +++ b/packages/graphql/tests/tck/operations/connect.test.ts @@ -122,7 +122,7 @@ describe("Cypher Connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_colors_connect0_node - CREATE (this0)-[:HAS_COLOR]->(this0_colors_connect0_node) + MERGE (this0)-[:HAS_COLOR]->(this0_colors_connect0_node) } } WITH this0, this0_colors_connect0_node @@ -137,7 +137,7 @@ describe("Cypher Connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0_colors_connect0_node UNWIND connectedNodes as this0_colors_connect0_node_photos0_node - CREATE (this0_colors_connect0_node)<-[:OF_COLOR]-(this0_colors_connect0_node_photos0_node) + MERGE (this0_colors_connect0_node)<-[:OF_COLOR]-(this0_colors_connect0_node_photos0_node) } } WITH this0, this0_colors_connect0_node, this0_colors_connect0_node_photos0_node @@ -152,7 +152,7 @@ describe("Cypher Connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0_colors_connect0_node_photos0_node UNWIND connectedNodes as this0_colors_connect0_node_photos0_node_color0_node - CREATE (this0_colors_connect0_node_photos0_node)-[:OF_COLOR]->(this0_colors_connect0_node_photos0_node_color0_node) + MERGE (this0_colors_connect0_node_photos0_node)-[:OF_COLOR]->(this0_colors_connect0_node_photos0_node_color0_node) } } WITH this0, this0_colors_connect0_node, this0_colors_connect0_node_photos0_node, this0_colors_connect0_node_photos0_node_color0_node @@ -174,7 +174,7 @@ describe("Cypher Connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_photos_connect0_node - CREATE (this0)-[:HAS_PHOTO]->(this0_photos_connect0_node) + MERGE (this0)-[:HAS_PHOTO]->(this0_photos_connect0_node) } } WITH this0, this0_photos_connect0_node @@ -189,7 +189,7 @@ describe("Cypher Connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0_photos_connect0_node UNWIND connectedNodes as this0_photos_connect0_node_color0_node - CREATE (this0_photos_connect0_node)-[:OF_COLOR]->(this0_photos_connect0_node_color0_node) + MERGE (this0_photos_connect0_node)-[:OF_COLOR]->(this0_photos_connect0_node_color0_node) } } WITH this0, this0_photos_connect0_node, this0_photos_connect0_node_color0_node @@ -209,7 +209,7 @@ describe("Cypher Connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_photos_connect1_node - CREATE (this0)-[:HAS_PHOTO]->(this0_photos_connect1_node) + MERGE (this0)-[:HAS_PHOTO]->(this0_photos_connect1_node) } } WITH this0, this0_photos_connect1_node @@ -224,7 +224,7 @@ describe("Cypher Connect", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0_photos_connect1_node UNWIND connectedNodes as this0_photos_connect1_node_color0_node - CREATE (this0_photos_connect1_node)-[:OF_COLOR]->(this0_photos_connect1_node_color0_node) + MERGE (this0_photos_connect1_node)-[:OF_COLOR]->(this0_photos_connect1_node_color0_node) } } WITH this0, this0_photos_connect1_node, this0_photos_connect1_node_color0_node diff --git a/packages/graphql/tests/tck/operations/create.test.ts b/packages/graphql/tests/tck/operations/create.test.ts index a2dc38213a..118243b809 100644 --- a/packages/graphql/tests/tck/operations/create.test.ts +++ b/packages/graphql/tests/tck/operations/create.test.ts @@ -328,7 +328,7 @@ describe("Cypher Create", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_actors_connect0_node - CREATE (this0)<-[:ACTED_IN]-(this0_actors_connect0_node) + MERGE (this0)<-[:ACTED_IN]-(this0_actors_connect0_node) } } WITH this0, this0_actors_connect0_node @@ -391,7 +391,7 @@ describe("Cypher Create", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_movies_connect0_node - CREATE (this0)-[:ACTED_IN]->(this0_movies_connect0_node) + MERGE (this0)-[:ACTED_IN]->(this0_movies_connect0_node) } } WITH this0, this0_movies_connect0_node diff --git a/packages/graphql/tests/tck/operations/update.test.ts b/packages/graphql/tests/tck/operations/update.test.ts index bf9163703e..ac9a1a2ab2 100644 --- a/packages/graphql/tests/tck/operations/update.test.ts +++ b/packages/graphql/tests/tck/operations/update.test.ts @@ -272,7 +272,7 @@ describe("Cypher Update", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actors0_connect0_node - CREATE (this)<-[this_actors0_connect0_relationship:ACTED_IN]-(this_actors0_connect0_node) + MERGE (this)<-[this_actors0_connect0_relationship:ACTED_IN]-(this_actors0_connect0_node) } } WITH this, this_actors0_connect0_node @@ -328,7 +328,7 @@ describe("Cypher Update", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actors0_connect0_node - CREATE (this)<-[this_actors0_connect0_relationship:ACTED_IN]-(this_actors0_connect0_node) + MERGE (this)<-[this_actors0_connect0_relationship:ACTED_IN]-(this_actors0_connect0_node) } } WITH this, this_actors0_connect0_node @@ -346,7 +346,7 @@ describe("Cypher Update", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_actors0_connect1_node - CREATE (this)<-[this_actors0_connect1_relationship:ACTED_IN]-(this_actors0_connect1_node) + MERGE (this)<-[this_actors0_connect1_relationship:ACTED_IN]-(this_actors0_connect1_node) } } WITH this, this_actors0_connect1_node diff --git a/packages/graphql/tests/tck/pringles.test.ts b/packages/graphql/tests/tck/pringles.test.ts index 9221d42db7..c7ac212dd4 100644 --- a/packages/graphql/tests/tck/pringles.test.ts +++ b/packages/graphql/tests/tck/pringles.test.ts @@ -153,7 +153,7 @@ describe("Cypher Create Pringles", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0_photos1_node UNWIND connectedNodes as this0_photos1_node_color_connect0_node - CREATE (this0_photos1_node)-[:OF_COLOR]->(this0_photos1_node_color_connect0_node) + MERGE (this0_photos1_node)-[:OF_COLOR]->(this0_photos1_node_color_connect0_node) } } WITH this0, this0_photos1_node, this0_photos1_node_color_connect0_node @@ -177,7 +177,7 @@ describe("Cypher Create Pringles", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0_photos2_node UNWIND connectedNodes as this0_photos2_node_color_connect0_node - CREATE (this0_photos2_node)-[:OF_COLOR]->(this0_photos2_node_color_connect0_node) + MERGE (this0_photos2_node)-[:OF_COLOR]->(this0_photos2_node_color_connect0_node) } } WITH this0, this0_photos2_node, this0_photos2_node_color_connect0_node @@ -286,7 +286,7 @@ describe("Cypher Create Pringles", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this_photos0 UNWIND connectedNodes as this_photos0_color0_connect0_node - CREATE (this_photos0)-[:OF_COLOR]->(this_photos0_color0_connect0_node) + MERGE (this_photos0)-[:OF_COLOR]->(this_photos0_color0_connect0_node) } } WITH this, this_photos0, this_photos0_color0_connect0_node diff --git a/packages/graphql/tests/tck/union.test.ts b/packages/graphql/tests/tck/union.test.ts index c75fd7210a..26957f6318 100644 --- a/packages/graphql/tests/tck/union.test.ts +++ b/packages/graphql/tests/tck/union.test.ts @@ -338,7 +338,7 @@ describe("Cypher Union", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this0 UNWIND connectedNodes as this0_search_Genre_connect0_node - CREATE (this0)-[:SEARCH]->(this0_search_Genre_connect0_node) + MERGE (this0)-[:SEARCH]->(this0_search_Genre_connect0_node) } } WITH this0, this0_search_Genre_connect0_node @@ -530,7 +530,7 @@ describe("Cypher Union", () => { WITH connectedNodes, parentNodes UNWIND parentNodes as this UNWIND connectedNodes as this_search_Genre0_connect0_node - CREATE (this)-[:SEARCH]->(this_search_Genre0_connect0_node) + MERGE (this)-[:SEARCH]->(this_search_Genre0_connect0_node) } } WITH this, this_search_Genre0_connect0_node