--liquibase formatted cypher --create non-controlled writer Khalid Mason under "ABRAHAM ORELLANA pka AraabMuzik" account --changeset jmarais:comp_writer_vendor_clash:1 runAlways:true MATCH (sw:PublishingSongWriter { id: "e4281f64-a56c-4afe-b9b0-1ecb9f17c703"}) CALL apoc.refactor.cloneNodes([sw], false, ["id"]) YIELD output SET output.id = apoc.create.uuid(), output.createdAt = datetime(), output.createdBy = "database/PUB-1592_fix_composition_writer_vendor_clash", output.lastModifiedAt = datetime(), output.lastModifiedBy = "database/PUB-1592_fix_composition_writer_vendor_clash" WITH output MATCH (v:Vendor { vendorId: 77005 }) WITH output, v CREATE (a:PublishingAgreement { id: apoc.create.uuid(), controlled: false, excludedTerritories: [], labelUuid: v.uuid, pubPublisherID: "NONE", pubWriterID: 59469, createdAt: datetime(), createdBy: "database/PUB-1592_fix_composition_writer_vendor_clash", lastModifiedAt: datetime(), lastModifiedBy: "database/PUB-1592_fix_composition_writer_vendor_clash" }) WITH output, v, a MERGE (v)-[rel:HAS_SIGNED_WRITER]->(output)-[agreeRel:HAS_AGREEMENT]->(a) SET rel.createdAt = datetime(), rel.createdBy = "database/PUB-1592_fix_composition_writer_vendor_clash", rel.lastModifiedAt = datetime(), rel.lastModifiedBy = "database/PUB-1592_fix_composition_writer_vendor_clash", agreeRel.createdAt = datetime(), agreeRel.createdBy = "database/PUB-1592_fix_composition_writer_vendor_clash", agreeRel.lastModifiedAt = datetime(), agreeRel.lastModifiedBy = "database/PUB-1592_fix_composition_writer_vendor_clash" --create non-controlled writer Alyssia Gonzalez under "ABRAHAM ORELLANA pka AraabMuzik" account --changeset jmarais:comp_writer_vendor_clash:2 runAlways:true MATCH (sw:PublishingSongWriter { id: "ab7b59c9-191b-4a6c-9040-eba663c3f4b2"}) CALL apoc.refactor.cloneNodes([sw], false, ["id"]) YIELD output SET output.id = apoc.create.uuid(), output.createdAt = datetime(), output.createdBy = "database/PUB-1592_fix_composition_writer_vendor_clash", output.lastModifiedAt = datetime(), output.lastModifiedBy = "database/PUB-1592_fix_composition_writer_vendor_clash" WITH output MATCH (v:Vendor { vendorId: 77005 }) WITH output, v CREATE (a:PublishingAgreement { id: apoc.create.uuid(), controlled: false, excludedTerritories: [], labelUuid: v.uuid, pubPublisherID: "NONE", pubWriterID: 59475, createdAt: datetime(), createdBy: "database/PUB-1592_fix_composition_writer_vendor_clash", lastModifiedAt: datetime(), lastModifiedBy: "database/PUB-1592_fix_composition_writer_vendor_clash" }) WITH output, v, a MERGE (v)-[rel:HAS_SIGNED_WRITER]->(output)-[agreeRel:HAS_AGREEMENT]->(a) SET rel.createdAt = datetime(), rel.createdBy = "database/PUB-1592_fix_composition_writer_vendor_clash", rel.lastModifiedAt = datetime(), rel.lastModifiedBy = "database/PUB-1592_fix_composition_writer_vendor_clash", agreeRel.createdAt = datetime(), agreeRel.createdBy = "database/PUB-1592_fix_composition_writer_vendor_clash", agreeRel.lastModifiedAt = datetime(), agreeRel.lastModifiedBy = "database/PUB-1592_fix_composition_writer_vendor_clash" --remove Mason under "Caddy Jones" 78485 account on comps under "ABRAHAM ORELLANA pka AraabMuzik" 77005 account & replace with correct writer --changeset jmarais:comp_writer_vendor_clash:3 runAlways:true MATCH (compVendor:Vendor { vendorId: 77005 })-[:HAS_COMPOSITION]->(c:PublishingComposition)-[oldRel:HAS_AGREEMENT]->(oldA:PublishingAgreement)<-[:HAS_AGREEMENT]-(oldSw:PublishingSongWriter { id: "e4281f64-a56c-4afe-b9b0-1ecb9f17c703" })<-[:HAS_SIGNED_WRITER]-(writerVendor:Vendor { vendorId: 78485 }) WITH collect(oldRel) as oldAgreementRels, compVendor, c UNWIND oldAgreementRels as oldAgreementRel WITH oldAgreementRel, compVendor, c MATCH (compVendor)-[:HAS_SIGNED_WRITER]-(newSw:PublishingSongWriter { pubWriterID: 59469 })-[:HAS_AGREEMENT]-(newA:PublishingAgreement { controlled: false }) MERGE (newA)<-[newRel:HAS_AGREEMENT]-(c) SET newRel = properties(oldAgreementRel), newRel.createdAt = datetime(), newRel.createdBy = "database/PUB-1592_fix_composition_writer_vendor_clash", newRel.lastModifiedAt = datetime(), newRel.lastModifiedBy = "database/PUB-1592_fix_composition_writer_vendor_clash" DELETE oldAgreementRel --remove Gonzalez under "Caddy Jones" 78485 account on comps under "ABRAHAM ORELLANA pka AraabMuzik" 77005 account & replace with correct writer --changeset jmarais:comp_writer_vendor_clash:4 runAlways:true MATCH (compVendor:Vendor { vendorId: 77005 })-[:HAS_COMPOSITION]->(c:PublishingComposition)-[oldRel:HAS_AGREEMENT]->(oldA:PublishingAgreement)<-[:HAS_AGREEMENT]-(oldSw:PublishingSongWriter { id: "ab7b59c9-191b-4a6c-9040-eba663c3f4b2" })<-[:HAS_SIGNED_WRITER]-(writerVendor:Vendor { vendorId: 78485 }) WITH collect(oldRel) as oldAgreementRels, compVendor, c UNWIND oldAgreementRels as oldAgreementRel WITH oldAgreementRel, compVendor, c MATCH (compVendor)-[:HAS_SIGNED_WRITER]-(newSw:PublishingSongWriter { pubWriterID: 59475 })-[:HAS_AGREEMENT]-(newA:PublishingAgreement { controlled: false }) MERGE (newA)<-[newRel:HAS_AGREEMENT]-(c) SET newRel = properties(oldAgreementRel), newRel.createdAt = datetime(), newRel.createdBy = "database/PUB-1592_fix_composition_writer_vendor_clash", newRel.lastModifiedAt = datetime(), newRel.lastModifiedBy = "database/PUB-1592_fix_composition_writer_vendor_clash" DELETE oldAgreementRel --remove Abraham Orellana under "Caddy Jones" 78485 account on comp "La Bamba" under 77005 account & replace with correct writer --changeset jmarais:comp_writer_vendor_clash:5 runAlways:true MATCH (compVendor:Vendor { vendorId: 77005 })-[:HAS_COMPOSITION]->(c:PublishingComposition { id: "49564e44-4111-41a0-8130-c8a98d49e245" })-[oldRel:HAS_AGREEMENT]->(oldA:PublishingAgreement)<-[:HAS_AGREEMENT]-(oldSw:PublishingSongWriter { id: "58c9fd09-be3b-4413-8a66-a80c7f8f648d" })<-[:HAS_SIGNED_WRITER]-(writerVendor:Vendor { vendorId: 78485 }) WITH oldRel, compVendor, c MATCH (newSw:PublishingSongWriter { id: "0b473a38-a420-47c3-ac83-511159d57deb" })-[:HAS_AGREEMENT]-(newA:PublishingAgreement { id: "cc876536-8760-4fad-babf-c93bb73dc644" }) MERGE (newA)<-[newRel:HAS_AGREEMENT]-(c) SET newRel = properties(oldRel), newRel.createdAt = datetime(), newRel.createdBy = "database/PUB-1592_fix_composition_writer_vendor_clash", newRel.lastModifiedAt = datetime(), newRel.lastModifiedBy = "database/PUB-1592_fix_composition_writer_vendor_clash" DELETE oldRel --remove Abraham Orellana under "ABRAHAM ORELLANA pka AraabMuzik" 77005 account on comps under "Caddy Jones" 78485 account & replace with correct writer --changeset jmarais:comp_writer_vendor_clash:6 runAlways:true MATCH (compVendor:Vendor { vendorId: 78485 })-[:HAS_COMPOSITION]->(c:PublishingComposition)-[oldRel:HAS_AGREEMENT]->(oldA:PublishingAgreement)<-[:HAS_AGREEMENT]-(oldSw:PublishingSongWriter { id: "0b473a38-a420-47c3-ac83-511159d57deb" })<-[:HAS_SIGNED_WRITER]-(writerVendor:Vendor { vendorId: 77005 }) WITH collect(oldRel) as oldAgreementRels, compVendor, c UNWIND oldAgreementRels as oldAgreementRel WITH oldAgreementRel, compVendor, c MATCH (newSw:PublishingSongWriter { id: "58c9fd09-be3b-4413-8a66-a80c7f8f648d" })-[:HAS_AGREEMENT]-(newA:PublishingAgreement { id: "bded2ef5-e803-4342-bdf8-9dffdcb2ef5a" }) MERGE (newA)<-[newRel:HAS_AGREEMENT]-(c) SET newRel = properties(oldAgreementRel), newRel.createdAt = datetime(), newRel.createdBy = "database/PUB-1592_fix_composition_writer_vendor_clash", newRel.lastModifiedAt = datetime(), newRel.lastModifiedBy = "database/PUB-1592_fix_composition_writer_vendor_clash" DELETE oldAgreementRel --create non-controlled writer George Moore under "Caddy Jones" account --changeset jmarais:comp_writer_vendor_clash:7 runAlways:true MATCH (sw:PublishingSongWriter { id: "ebdd61ec-f40f-4fa1-9eed-ba1afe1b594e"}) CALL apoc.refactor.cloneNodes([sw], false, ["id"]) YIELD output SET output.id = apoc.create.uuid(), output.createdAt = datetime(), output.createdBy = "database/PUB-1592_fix_composition_writer_vendor_clash", output.lastModifiedAt = datetime(), output.lastModifiedBy = "database/PUB-1592_fix_composition_writer_vendor_clash" WITH output MATCH (v:Vendor { vendorId: 78485 }) WITH output, v CREATE (a:PublishingAgreement { id: apoc.create.uuid(), controlled: false, excludedTerritories: [], labelUuid: v.uuid, pubPublisherID: "NONE", pubWriterID: 102940, createdAt: datetime(), createdBy: "database/PUB-1592_fix_composition_writer_vendor_clash", lastModifiedAt: datetime(), lastModifiedBy: "database/PUB-1592_fix_composition_writer_vendor_clash" }) WITH output, v, a MERGE (v)-[rel:HAS_SIGNED_WRITER]->(output)-[agreeRel:HAS_AGREEMENT]->(a) SET rel.createdAt = datetime(), rel.createdBy = "database/PUB-1592_fix_composition_writer_vendor_clash", rel.lastModifiedAt = datetime(), rel.lastModifiedBy = "database/PUB-1592_fix_composition_writer_vendor_clash", agreeRel.createdAt = datetime(), agreeRel.createdBy = "database/PUB-1592_fix_composition_writer_vendor_clash", agreeRel.lastModifiedAt = datetime(), agreeRel.lastModifiedBy = "database/PUB-1592_fix_composition_writer_vendor_clash" --remove George Moore under "ABRAHAM ORELLANA pka AraabMuzik" 77005 account on comps under "Caddy Jones" 78485 account & replace with correct writer --changeset jmarais:comp_writer_vendor_clash:8 runAlways:true MATCH (compVendor:Vendor { vendorId: 78485 })-[:HAS_COMPOSITION]->(c:PublishingComposition)-[oldRel:HAS_AGREEMENT]->(oldA:PublishingAgreement)<-[:HAS_AGREEMENT]-(oldSw:PublishingSongWriter { id: "ebdd61ec-f40f-4fa1-9eed-ba1afe1b594e" })<-[:HAS_SIGNED_WRITER]-(writerVendor:Vendor { vendorId: 77005 }) WITH collect(oldRel) as oldAgreementRels, compVendor, c UNWIND oldAgreementRels as oldAgreementRel WITH oldAgreementRel, compVendor, c MATCH (compVendor)-[:HAS_SIGNED_WRITER]-(newSw:PublishingSongWriter { pubWriterID: 102940 })-[:HAS_AGREEMENT]-(newA:PublishingAgreement { controlled: false }) MERGE (newA)<-[newRel:HAS_AGREEMENT]-(c) SET newRel = properties(oldAgreementRel), newRel.createdAt = datetime(), newRel.createdBy = "database/PUB-1592_fix_composition_writer_vendor_clash", newRel.lastModifiedAt = datetime(), newRel.lastModifiedBy = "database/PUB-1592_fix_composition_writer_vendor_clash" DELETE oldAgreementRel --remove David R. Styles under "License Lounge" account on comp under "Next Records" account & replace with correct writer --changeset jmarais:comp_writer_vendor_clash:9 runAlways:true MATCH (compVendor:Vendor { vendorId: 24483 })-[:HAS_COMPOSITION]->(c:PublishingComposition)-[oldRel:HAS_AGREEMENT]->(oldA:PublishingAgreement)<-[:HAS_AGREEMENT]-(oldSw:PublishingSongWriter { id: "0233b175-a3ff-463b-beb5-963ba6a127fb" })<-[:HAS_SIGNED_WRITER]-(writerVendor:Vendor { vendorId: 75156 }) WITH oldRel, compVendor, c MATCH (newSw:PublishingSongWriter { id: "95e3f1be-faee-4810-9753-c1154dcbb165" })-[:HAS_AGREEMENT]-(newA:PublishingAgreement { id: "5d0df07a-27e6-4bc9-ab22-864350f76e29" }) MERGE (newA)<-[newRel:HAS_AGREEMENT]-(c) SET newRel = properties(oldRel), newRel.createdAt = datetime(), newRel.createdBy = "database/PUB-1592_fix_composition_writer_vendor_clash", newRel.lastModifiedAt = datetime(), newRel.lastModifiedBy = "database/PUB-1592_fix_composition_writer_vendor_clash" DELETE oldRel --remove Jeremy P Felton under "Next Records" account on comp under "Grace Weber" account & replace with correct writer --changeset jmarais:comp_writer_vendor_clash:10 runAlways:true MATCH (compVendor:Vendor { vendorId: 72282 })-[:HAS_COMPOSITION]->(c:PublishingComposition)-[oldRel:HAS_AGREEMENT]->(oldA:PublishingAgreement)<-[:HAS_AGREEMENT]-(oldSw:PublishingSongWriter { id: "6d4bccb7-1bfd-4c01-bb48-2129e291dd43" })<-[:HAS_SIGNED_WRITER]-(writerVendor:Vendor { vendorId: 24483 }) WITH oldRel, compVendor, c MATCH (newSw:PublishingSongWriter { id: "9af0153f-74ba-46ed-a689-5ec41aaa5fb7" })-[:HAS_AGREEMENT]-(newA:PublishingAgreement { id: "44285733-c3d8-4f9b-84f4-4cc95b986042" }) MERGE (newA)<-[newRel:HAS_AGREEMENT]-(c) SET newRel = properties(oldRel), newRel.createdAt = datetime(), newRel.createdBy = "database/PUB-1592_fix_composition_writer_vendor_clash", newRel.lastModifiedAt = datetime(), newRel.lastModifiedBy = "database/PUB-1592_fix_composition_writer_vendor_clash" DELETE oldRel --remove OLA OVERBY under "JA GROUP" account on comp under "Jansen Plateproduksjon" account & replace with correct writer --changeset jmarais:comp_writer_vendor_clash:11 runAlways:true MATCH (compVendor:Vendor { vendorId: 24827 })-[:HAS_COMPOSITION]->(c:PublishingComposition)-[oldRel:HAS_AGREEMENT]->(oldA:PublishingAgreement)<-[:HAS_AGREEMENT]-(oldSw:PublishingSongWriter { id: "4ada77e9-4a94-4082-b342-c9c8d8820026" })<-[:HAS_SIGNED_WRITER]-(writerVendor:Vendor { vendorId: 791849 }) WITH oldRel, compVendor, c MATCH (newSw:PublishingSongWriter { id: "c65cfcaa-acf9-49e5-8827-44d0c7477f36" })-[:HAS_AGREEMENT]-(newA:PublishingAgreement { id: "1a67b204-46d1-486f-aa14-f706ebd412f0" }) MERGE (newA)<-[newRel:HAS_AGREEMENT]-(c) SET newRel = properties(oldRel), newRel.createdAt = datetime(), newRel.createdBy = "database/PUB-1592_fix_composition_writer_vendor_clash", newRel.lastModifiedAt = datetime(), newRel.lastModifiedBy = "database/PUB-1592_fix_composition_writer_vendor_clash" DELETE oldRel