--liquibase formatted cypher --changeset yostapyuk:sw_agreements_deduplication:1 runOnChange:true MATCH (:PublishingAgreement {id: "2545be9f-bb0c-488a-81c9-6258c56b96f1"}) <-[oldRel:HAS_AGREEMENT]-(c:PublishingComposition), (a:PublishingAgreement {id: "98e7d967-d789-4fd7-abf1-b5f858d9dda8"}) MERGE (a)<-[newRel:HAS_AGREEMENT]-(c) SET oldRel.lastModifiedAt = datetime(), oldRel.lastModifiedBy = "database/PUB-1614_sw_agreements_deduplication", newRel = properties(oldRel), newRel.createdAt = datetime(), newRel.createdBy = "database/PUB-1614_sw_agreements_deduplication", newRel.lastModifiedAt = datetime(), newRel.lastModifiedBy = "database/PUB-1614_sw_agreements_deduplication" DELETE oldRel; --changeset yostapyuk:sw_agreements_deduplication:2 runOnChange:true MATCH (:PublishingAgreement {id: "2545be9f-bb0c-488a-81c9-6258c56b96f1"}) <-[oldRel:HAS_AGREEMENT]-(:PublishingPublisher {id: "119ff43b-5060-4a83-b380-13ced36fcbd5"}) SET oldRel.lastModifiedAt = datetime(), oldRel.lastModifiedBy = "database/PUB-1614_sw_agreements_deduplication" DELETE oldRel; --changeset yostapyuk:sw_agreements_deduplication:3 runOnChange:true MATCH (:Vendor {uuid: "4a8c5ccd-625b-4f2d-927f-dc4d4af5718d"}) -[oldRel1:HAS_SIGNED_WRITER]->(sw:PublishingSongWriter {id: "b37306e8-dbf6-4fd5-adb7-7db8ea3cba76"}) -[oldRel2:HAS_AGREEMENT]->(a:PublishingAgreement {id: "98e7d967-d789-4fd7-abf1-b5f858d9dda8"}), (oldA:PublishingAgreement {id: "2545be9f-bb0c-488a-81c9-6258c56b96f1"}) <-[oldRel3:HAS_AGREEMENT]-(sw) SET oldRel1.lastModifiedAt = datetime(), oldRel1.lastModifiedBy = "database/PUB-1614_sw_agreements_deduplication", oldRel2.lastModifiedAt = datetime(), oldRel2.lastModifiedBy = "database/PUB-1614_sw_agreements_deduplication", oldRel3.lastModifiedAt = datetime(), oldRel3.lastModifiedBy = "database/PUB-1614_sw_agreements_deduplication", sw.lastModifiedAt = datetime(), sw.lastModifiedBy = "database/PUB-1614_sw_agreements_deduplication" WITH sw, oldA DETACH DELETE sw, oldA;