<?xml version="1.0" encoding="UTF-8"?>
<changelog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://www.liquigraph.org/schema/1.0/liquigraph.xsd">
    <changeset id="KDH-156_vendor_to_d3_p2:1" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                CALL apoc.periodic.iterate(
                "
                    MATCH (pr:Project {id: $project_id})-[:INCLUDES]->(:Product)-[:INCLUDES]->(:Track)<-[:PARTICIPATED_IN]-(lp:LabelParticipant)<-[gpToLp:REPRESENTS]-(gp:GlobalParticipant)
                    WHERE lp.subaccountId <> pr.subaccountId
                    RETURN pr, lp, gpToLp, gp;
                ",
                "
                    CALL apoc.util.sleep(1)
                    MERGE (nlp:LabelParticipant:Orchard {normalizedName: lp.normalizedName, vendorId: lp.vendorId, subaccountId: pr.subaccountId})
                        ON CREATE SET
                            nlp.id = datetime.realtime().epochMillis,
                            nlp.uuid = apoc.create.uuid(),
                            nlp.createdAt = datetime(),
                            nlp.createdBy = 'database/KDH-156_vendor_to_d3_p2:1'
                        SET nlp += apoc.map.removeKeys(lp, ['id', 'uuid', 'vendorId', 'subaccountId', 'createdAt', 'createdBy']),
                            nlp.lastModifiedAt = datetime(),
                            nlp.lastModifiedBy = 'database/KDH-156_vendor_to_d3_p2:1'
                    WITH *
                    CALL apoc.merge.relationship(gp, type(gpToLp), null, gpToLp, nlp)
                    YIELD rel AS rel
                    RETURN nlp as labelParticipant;
                ",
                {batchSize:1, iterateList:true, parallel:false, params: {project_id: toInteger(event.PROJECT_ID)}}
                )
                YIELD total, failedOperations, errorMessages, failedBatches, batch
                RETURN total, failedOperations, errorMessages, failedBatches, batch;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:2" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                CALL apoc.periodic.iterate(
                "
                    MATCH (pr:Project {id: $project_id})-[:INCLUDES]->(:Product)-[:INCLUDES]->(t:Track)-[lpToT]-(lp:LabelParticipant)-[cf:CREATED_FROM]->(ai:ArtistInfo)
                    WHERE lp.subaccountId <> pr.subaccountId
                    RETURN pr, lp, cf, ai
                ",
                "
                CALL apoc.util.sleep(1)
                MERGE (nlp:LabelParticipant:Orchard {name: lp.name, vendorId: lp.vendorId, subaccountId: pr.subaccountId})
                    ON CREATE SET
                        nlp.id = datetime.realtime().epochMillis,
                        nlp.uuid = apoc.create.uuid(),
                        nlp.createdAt = datetime(),
                        nlp.createdBy = 'database/KDH-156_vendor_to_d3_p2:2'
                    SET nlp += apoc.map.removeKeys(lp, ['id', 'uuid', 'vendorId', 'subaccountId', 'createdAt', 'createdBy']),
                        nlp.lastModifiedAt = datetime(),
                        nlp.lastModifiedBy = 'database/KDH-156_vendor_to_d3_p2:2'
                WITH *
                CALL apoc.merge.relationship(nlp, type(cf), null, cf, ai)
                YIELD rel AS rel
                RETURN nlp as labelParticipant",
                  {batchSize:1, iterateList:true, parallel:false, params: {project_id: toInteger(event.PROJECT_ID)}}
                )
                YIELD total, failedOperations, errorMessages, failedBatches, batch
                RETURN total, failedOperations, errorMessages, failedBatches, batch;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:3" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                MATCH (pr:Project {id: toInteger(event.PROJECT_ID)})-[:INCLUDES]->(:Product)-[:INCLUDES]->(:Track)<-[:PARTICIPATED_IN]-(lp:LabelParticipant)-[cf:CREATED_FROM]->(:ArtistInfo)
                WHERE lp.subaccountId <> pr.subaccountId
                DELETE cf;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:4" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                CALL apoc.periodic.iterate(
                "
                    MATCH (pr:Project {id: $project_id})-[:INCLUDES]->(:Product)-[:INCLUDES]->(t:Track)<-[lpToT:PARTICIPATED_IN]-(lp:LabelParticipant)
                    WHERE lp.subaccountId <> pr.subaccountId
                    RETURN pr, lp, lpToT, t
                ",
                "
                    CALL apoc.util.sleep(1)
                    MERGE (nlp:LabelParticipant:Orchard {normalizedName: lp.normalizedName, vendorId: pr.vendorId, subaccountId: pr.subaccountId})
                        ON CREATE SET
                            nlp.id = datetime.realtime().epochMillis,
                            nlp.uuid = apoc.create.uuid(),
                            nlp.createdAt = datetime(),
                            nlp.createdBy = 'database/KDH-156_vendor_to_d3_p2:4'
                        SET nlp += apoc.map.removeKeys(lp, ['id', 'uuid', 'vendorId', 'subaccountId', 'createdAt', 'createdBy']),
                            nlp.lastModifiedAt = datetime(),
                            nlp.lastModifiedBy = 'database/KDH-156_vendor_to_d3_p2:4'
                    WITH *
                    CALL apoc.merge.relationship(nlp, type(lpToT), {participated_as: lpToT.participated_as}, lpToT, t)
                    YIELD rel AS rel1
                    RETURN nlp as labelParticipant
                ",
                {batchSize:1, iterateList:true, parallel:false, params: {project_id: toInteger(event.PROJECT_ID)}}
                )
                YIELD total, failedOperations, errorMessages, failedBatches, batch
                RETURN total, failedOperations, errorMessages, failedBatches, batch;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:5" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                CALL apoc.periodic.iterate(
                "
                    MATCH (pr:Project {id: $project_id})-[:INCLUDES]->(:Product)-[:INCLUDES]->(t:Track)<-[:PARTICIPATED_IN]-(lp:LabelParticipant)
                    WHERE lp.subaccountId <> pr.subaccountId
                    MATCH (lp)-[cf:CREATED_FROM]->(ta:TrackArtist)<-[:HAS_SOURCE_ARTIST]-(t)
                    RETURN pr, lp, cf, ta
                ",
                "
                    CALL apoc.util.sleep(1)
                    MERGE (nlp:LabelParticipant:Orchard {normalizedName: lp.normalizedName, vendorId: lp.vendorId, subaccountId: pr.subaccountId})
                        ON CREATE SET
                            nlp.id = datetime.realtime().epochMillis,
                            nlp.uuid = apoc.create.uuid(),
                            nlp.createdAt = datetime(),
                            nlp.createdBy = 'database/KDH-156_vendor_to_d3_p2:5'
                        SET nlp += apoc.map.removeKeys(lp, ['id', 'uuid', 'vendorId', 'subaccountId', 'createdAt', 'createdBy']),
                            nlp.lastModifiedAt = datetime(),
                            nlp.lastModifiedBy = 'database/KDH-156_vendor_to_d3_p2:5'
                    WITH *
                    CALL apoc.merge.relationship(nlp, type(cf), null, cf, ta)
                    YIELD rel AS rel
                    RETURN nlp as labelParticipant
                ",
                {batchSize:1, iterateList:true, parallel:false, params: {project_id: toInteger(event.PROJECT_ID)}}
                )
                YIELD total, failedOperations, errorMessages, failedBatches, batch
                RETURN total, failedOperations, errorMessages, failedBatches, batch;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:6" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                CALL apoc.periodic.iterate(
                "
                    MATCH (pr:Project {id: $project_id})-[:INCLUDES]->(:Product)-[:INCLUDES]->(t:Track)<-[:PARTICIPATED_IN]-(lp:LabelParticipant)
                    WHERE lp.subaccountId <> pr.subaccountId
                    MATCH (lp)-[cf:CREATED_FROM]->(tw:TrackWriter)<-[:HAS_SOURCE_ARTIST]-(t)
                    RETURN pr, lp, cf, tw
                ",
                "
                    CALL apoc.util.sleep(1)
                    MERGE (nlp:LabelParticipant:Orchard {normalizedName: lp.normalizedName, vendorId: lp.vendorId, subaccountId: pr.subaccountId})
                        ON CREATE SET
                            nlp.id = datetime.realtime().epochMillis,
                            nlp.uuid = apoc.create.uuid(),
                            nlp.createdAt = datetime(),
                            nlp.createdBy = 'database/KDH-156_vendor_to_d3_p2:6'
                        SET nlp += apoc.map.removeKeys(lp, ['id', 'uuid', 'vendorId', 'subaccountId', 'createdAt', 'createdBy']),
                            nlp.lastModifiedAt = datetime(),
                            nlp.lastModifiedBy = 'database/KDH-156_vendor_to_d3_p2:6'
                    WITH *
                    CALL apoc.merge.relationship(nlp, type(cf), null, cf, tw)
                    YIELD rel AS rel
                    RETURN nlp as labelParticipant
                ",
                {batchSize:1, iterateList:true, parallel:false, params: {project_id: toInteger(event.PROJECT_ID)}}
                )
                YIELD total, failedOperations, errorMessages, failedBatches, batch
                RETURN total, failedOperations, errorMessages, failedBatches, batch;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:7" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                MATCH (pr:Project {id: toInteger(event.PROJECT_ID)})-[:INCLUDES]->(:Product)-[:INCLUDES]->(t:Track)<-[lpToT:PARTICIPATED_IN]-(lp:LabelParticipant)
                WHERE lp.subaccountId <> pr.subaccountId
                OPTIONAL MATCH (lp)-[lpToTa:CREATED_FROM]->(:TrackArtist)<-[:HAS_SOURCE_ARTIST]-(t)
                OPTIONAL MATCH (lp)-[lpToTw:CREATED_FROM]->(:TrackWriter)<-[:HAS_SOURCE_ARTIST]-(t)
                DELETE lpToT, lpToTa, lpToTw;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:8" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                CALL apoc.periodic.iterate(
                "
                    MATCH (pr:Project {id: $project_id})-[:INCLUDES]->(:Product)<-[:PARTICIPATED_IN]-(lp:LabelParticipant)<-[gpToLp:REPRESENTS]-(gp:GlobalParticipant)
                    WHERE lp.subaccountId <> pr.subaccountId
                    RETURN pr, lp, gpToLp, gp
                ",
                "
                    CALL apoc.util.sleep(1)
                    MERGE (nlp:LabelParticipant:Orchard {normalizedName: lp.normalizedName, vendorId: lp.vendorId, subaccountId: pr.subaccountId})
                    ON CREATE SET
                        nlp.id = datetime.realtime().epochMillis,
                        nlp.uuid = apoc.create.uuid(),
                        nlp.createdAt = datetime(),
                        nlp.createdBy = 'database/KDH-156_vendor_to_d3_p2:8'
                    SET nlp += apoc.map.removeKeys(lp, ['id', 'uuid', 'vendorId', 'subaccountId', 'createdAt', 'createdBy']),
                        nlp.lastModifiedAt = datetime(),
                        nlp.lastModifiedBy = 'database/KDH-156_vendor_to_d3_p2:8'
                    WITH *
                    CALL apoc.merge.relationship(gp, type(gpToLp), null, gpToLp, nlp)
                    YIELD rel AS rel
                    RETURN nlp as labelParticipant
                ",
                {batchSize:1, iterateList:true, parallel:false, params: {project_id: toInteger(event.PROJECT_ID)}}
                )
                YIELD total, failedOperations, errorMessages, failedBatches, batch
                RETURN total, failedOperations, errorMessages, failedBatches, batch;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:9" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                CALL apoc.periodic.iterate(
                "
                    MATCH (pr:Project {id: $project_id})-[:INCLUDES]->(p:Product)<-[lpToP:PARTICIPATED_IN]-(lp:LabelParticipant)
                    WHERE lp.subaccountId <> pr.subaccountId
                    RETURN pr, lp, lpToP, p
                ",
                "
                    CALL apoc.util.sleep(1)
                    MERGE (nlp:LabelParticipant:Orchard {normalizedName: lp.normalizedName, vendorId: lp.vendorId, subaccountId: pr.subaccountId})
                        ON CREATE SET
                            nlp.id = datetime.realtime().epochMillis,
                            nlp.uuid = apoc.create.uuid(),
                            nlp.createdAt = datetime(),
                            nlp.createdBy = 'database/KDH-156_vendor_to_d3_p2:9'
                        SET nlp += apoc.map.removeKeys(lp, ['id', 'uuid', 'vendorId', 'subaccountId', 'createdAt', 'createdBy']),
                            nlp.lastModifiedAt = datetime(),
                            nlp.lastModifiedBy = 'database/KDH-156_vendor_to_d3_p2:9'
                    WITH *
                    CALL apoc.merge.relationship(nlp, type(lpToP), {participated_as: lpToP.participated_as}, lpToP, p)
                    YIELD rel AS rel
                    RETURN nlp as labelParticipant
                ",
                {batchSize:1, iterateList:true, parallel:false, params: {project_id: toInteger(event.PROJECT_ID)}}
                )
                YIELD total, failedOperations, errorMessages, failedBatches, batch
                RETURN total, failedOperations, errorMessages, failedBatches, batch;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:10" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                CALL apoc.periodic.iterate(
                "
                    MATCH (pr:Project {id: $project_id})-[:INCLUDES]->(:Product)<-[:PARTICIPATED_IN]-(lp:LabelParticipant)-[cf:CREATED_FROM]->(ai:ArtistInfo)
                    WHERE lp.subaccountId <> pr.subaccountId
                    RETURN pr, lp, cf, ai
                ",
                "
                    CALL apoc.util.sleep(1)
                    MERGE (nlp:LabelParticipant:Orchard {normalizedName: lp.normalizedName, vendorId: lp.vendorId, subaccountId: pr.subaccountId})
                        ON CREATE SET
                            nlp.id = datetime.realtime().epochMillis,
                            nlp.uuid = apoc.create.uuid(),
                            nlp.createdAt = datetime(),
                            nlp.createdBy = 'database/KDH-156_vendor_to_d3_p2:10'
                        SET nlp += apoc.map.removeKeys(lp, ['id', 'uuid', 'vendorId', 'subaccountId', 'createdAt', 'createdBy']),
                            nlp.lastModifiedAt = datetime(),
                            nlp.lastModifiedBy = 'database/KDH-156_vendor_to_d3_p2:10'
                    WITH *
                    CALL apoc.merge.relationship(nlp, type(cf), null, cf, ai)
                    YIELD rel AS rel
                    RETURN nlp as labelParticipant
                ",
                {batchSize:1, iterateList:true, parallel:false, params: {project_id: toInteger(event.PROJECT_ID)}}
                )
                YIELD total, failedOperations, errorMessages, failedBatches, batch
                RETURN total, failedOperations, errorMessages, failedBatches, batch;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:11" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                MATCH (pr:Project {id: toInteger(event.PROJECT_ID)})-[:INCLUDES]->(:Product)<-[:PARTICIPATED_IN]-(lp:LabelParticipant)-[cf:CREATED_FROM]->(:ArtistInfo)
                WHERE lp.subaccountId <> pr.subaccountId
                DELETE cf;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:12" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                CALL apoc.periodic.iterate(
                "
                    MATCH (pr:Project {id: $project_id})-[:INCLUDES]->(p:Product)<-[:PARTICIPATED_IN]-(lp:LabelParticipant)
                    WHERE lp.subaccountId <> pr.subaccountId
                    MATCH (lp)-[lpToRa:CREATED_FROM]->(ra:ReleaseArtist {productId: p.id})
                    RETURN pr, lp, lpToRa, ra
                ",
                "
                    CALL apoc.util.sleep(1)
                    MERGE (nlp:LabelParticipant:Orchard {normalizedName: lp.normalizedName, vendorId: lp.vendorId, subaccountId: pr.subaccountId})
                        ON CREATE SET
                            nlp.id = datetime.realtime().epochMillis,
                            nlp.uuid = apoc.create.uuid(),
                            nlp.createdAt = datetime(),
                            nlp.createdBy = 'database/KDH-156_vendor_to_d3_p2:12'
                        SET nlp += apoc.map.removeKeys(lp, ['id', 'uuid', 'vendorId', 'subaccountId', 'createdAt', 'createdBy']),
                            nlp.lastModifiedAt = datetime(),
                            nlp.lastModifiedBy = 'database/KDH-156_vendor_to_d3_p2:12'
                    WITH *
                    CALL apoc.merge.relationship(nlp, type(lpToRa), null, lpToRa, ra)
                    YIELD rel AS rel
                    RETURN nlp as labelParticipant
                ",
                {batchSize:1, iterateList:true, parallel:false, params: {project_id: toInteger(event.PROJECT_ID)}}
                )
                YIELD total, failedOperations, errorMessages, failedBatches, batch
                RETURN total, failedOperations, errorMessages, failedBatches, batch;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:13" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                MATCH (pr:Project {id: toInteger(event.PROJECT_ID)})-[:INCLUDES]->(p:Product)<-[lpToP:PARTICIPATED_IN]-(lp:LabelParticipant)
                WHERE lp.subaccountId <> pr.subaccountId
                OPTIONAL MATCH (lp)-[lpToRa:CREATED_FROM]->(:ReleaseArtist {productId: p.id})
                DELETE lpToP, lpToRa;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:14" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                CALL apoc.periodic.iterate(
                "
                    MATCH (pr:Project {id: $project_id})-[:CREATED_FOR_PARTICIPANT]->(lp:LabelParticipant)-[cf:CREATED_FROM]->(ai:ArtistInfo)
                    WHERE lp.subaccountId <> pr.subaccountId
                    RETURN pr, lp, cf, ai
                ",
                "
                    CALL apoc.util.sleep(1)
                    MERGE (nlp:LabelParticipant:Orchard {normalizedName: lp.normalizedName, vendorId: lp.vendorId, subaccountId: pr.subaccountId})
                        ON CREATE SET
                            nlp.id = datetime.realtime().epochMillis,
                            nlp.uuid = apoc.create.uuid(),
                            nlp.createdAt = datetime(),
                            nlp.createdBy = 'database/KDH-156_vendor_to_d3_p2:14'
                        SET nlp += apoc.map.removeKeys(lp, ['id', 'uuid', 'vendorId', 'subaccountId', 'createdAt', 'createdBy']),
                            nlp.lastModifiedAt = datetime(),
                            nlp.lastModifiedBy = 'database/KDH-156_vendor_to_d3_p2:14'
                    WITH *
                    CALL apoc.merge.relationship(nlp, type(cf), null, cf, ai)
                    YIELD rel AS rel
                    RETURN nlp as labelParticipant
                ",
                {batchSize:1, iterateList:true, parallel:false, params: {project_id: toInteger(event.PROJECT_ID)}}
                )
                YIELD total, failedOperations, errorMessages, failedBatches, batch
                RETURN total, failedOperations, errorMessages, failedBatches, batch;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:15" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                MATCH (pr:Project {id: toInteger(event.PROJECT_ID)})-[:CREATED_FOR_PARTICIPANT]->(lp:LabelParticipant)-[cf:CREATED_FROM]->(:ArtistInfo)
                WHERE lp.subaccountId <> pr.subaccountId
                DELETE cf;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:16" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                CALL apoc.periodic.iterate(
                "
                    MATCH (pr:Project {id: $project_id})-[lpToP:CREATED_FOR_PARTICIPANT]->(lp:LabelParticipant)
                    WHERE lp.subaccountId <> pr.subaccountId
                    RETURN pr, lp, lpToP
                ",
                "
                    CALL apoc.util.sleep(1)
                    MERGE (nlp:LabelParticipant:Orchard {normalizedName: lp.normalizedName, vendorId: lp.vendorId, subaccountId: pr.subaccountId})
                        ON CREATE SET
                            nlp.id = datetime.realtime().epochMillis,
                            nlp.uuid = apoc.create.uuid(),
                            nlp.createdAt = datetime(),
                            nlp.createdBy = 'database/KDH-156_vendor_to_d3_p2:16'
                        SET nlp += apoc.map.removeKeys(lp, ['id', 'uuid', 'vendorId', 'subaccountId', 'createdAt', 'createdBy']),
                            nlp.lastModifiedAt = datetime(),
                            nlp.lastModifiedBy = 'database/KDH-156_vendor_to_d3_p2:16'
                    WITH *
                    CALL apoc.merge.relationship(pr, type(lpToP), null, lpToP, nlp)
                    YIELD rel AS rel
                    RETURN nlp as labelParticipant
                ",
                {batchSize:1, iterateList:true, parallel:false, params: {project_id: toInteger(event.PROJECT_ID)}}
                )
                YIELD total, failedOperations, errorMessages, failedBatches, batch
                RETURN total, failedOperations, errorMessages, failedBatches, batch;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:17" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                MATCH (pr:Project {id: toInteger(event.PROJECT_ID)})-[lpToP:CREATED_FOR_PARTICIPANT]->(lp:LabelParticipant)
                WHERE lp.subaccountId <> pr.subaccountId
                DELETE lpToP;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:18" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                CALL apoc.periodic.iterate(
                "
                    MATCH (pr:Project {id: $project_id})-[:INCLUDES]->(:Product)-[:INCLUDES]->(:Track)-[:IS_PLACEMENT_OF]->(:LabelSoundRecording)<-[:ON_LABEL_SOUND_RECORDING]-(lsrp:LabelSoundRecordingParticipation)<-[hlsrp:HAS_LABEL_SOUND_RECORDING_PARTICIPATION]-(lp:LabelParticipant)
                    WHERE lp.subaccountId <> pr.subaccountId
                    RETURN pr, lp, hlsrp, lsrp
                ",
                "
                    CALL apoc.util.sleep(1)
                    MERGE (nlp:LabelParticipant:Orchard {normalizedName: lp.normalizedName, vendorId: lp.vendorId, subaccountId: pr.subaccountId})
                        ON CREATE SET
                            nlp.id = datetime.realtime().epochMillis,
                            nlp.uuid = apoc.create.uuid(),
                            nlp.createdAt = datetime(),
                            nlp.createdBy = 'database/KDH-156_vendor_to_d3_p2:18'
                        SET nlp += apoc.map.removeKeys(lp, ['id', 'uuid', 'vendorId', 'subaccountId', 'createdAt', 'createdBy']),
                            nlp.lastModifiedAt = datetime(),
                            nlp.lastModifiedBy = 'database/KDH-156_vendor_to_d3_p2:18'
                    WITH *
                    CALL apoc.merge.relationship(nlp, type(hlsrp), null, hlsrp, lsrp)
                    YIELD rel AS rel
                    RETURN nlp as labelParticipant
                ",
                {batchSize:1, iterateList:true, parallel:false, params: {project_id: toInteger(event.PROJECT_ID)}}
                )
                YIELD total, failedOperations, errorMessages, failedBatches, batch
                RETURN total, failedOperations, errorMessages, failedBatches, batch;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:19" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                MATCH (pr:Project {id: toInteger(event.PROJECT_ID)})-[:INCLUDES]->(:Product)-[:INCLUDES]->(t:Track)-[lsrToT]->(lsr:LabelSoundRecording)<-[:ON_LABEL_SOUND_RECORDING]-(lsrp:LabelSoundRecordingParticipation)<-[hlsrp:HAS_LABEL_SOUND_RECORDING_PARTICIPATION]-(lp:LabelParticipant)
                WHERE lp.subaccountId <> pr.subaccountId
                DELETE hlsrp;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:20" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                CALL apoc.periodic.iterate(
                "
                    MATCH (pr:Project {id: $project_id})-[:INCLUDES]->(:Product)-[:INCLUDES]->(t:Track)-[lsrToT]-(lsr:LabelSoundRecording)<-[olsr:ON_LABEL_SOUND_RECORDING]-(lsrp:LabelSoundRecordingParticipation)
                    WHERE lsr.subaccountId <> pr.subaccountId
                    RETURN pr, lsr, olsr, lsrp
                ",
                "
                    MERGE (nlsr:LabelSoundRecording:Orchard {isrc: lsr.isrc, vendorId: pr.vendorId, subaccountId: pr.subaccountId})
                        ON CREATE SET
                            nlsr.id = apoc.create.uuid(),
                            nlsr.createdAt = datetime(),
                            nlsr.createdBy = 'database/KDH-156_vendor_to_d3_p2:20'
                        SET nlsr += apoc.map.removeKeys(lsr, ['id', 'isrc', 'vendorId', 'subaccountId', 'createdAt', 'createdBy']),
                            nlsr.lastModifiedAt = datetime(),
                            nlsr.lastModifiedBy = 'database/KDH-156_vendor_to_d3_p2:20'
                    WITH *
                    CALL apoc.merge.relationship(lsrp, type(olsr), {}, olsr, nlsr)
                    YIELD rel
                    RETURN nlsr as labelSoundRecording
                ",
                {batchSize:1, iterateList:true, parallel:false, params: {project_id: toInteger(event.PROJECT_ID)}}
                )
                YIELD total, failedOperations, errorMessages, failedBatches, batch
                RETURN total, failedOperations, errorMessages, failedBatches, batch;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:21" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                MATCH (pr:Project {id: toInteger(event.PROJECT_ID)})-[:INCLUDES]->(:Product)-[:INCLUDES]->(t:Track)-[lsrToT]-(lsr:LabelSoundRecording)<-[olsr:ON_LABEL_SOUND_RECORDING]-(lsrp:LabelSoundRecordingParticipation)
                WHERE lsr.subaccountId <> pr.subaccountId
                DELETE olsr;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:22" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                CALL apoc.periodic.iterate(
                "
                    MATCH (pr:Project {id: $project_id})-[:INCLUDES]->(:Product)-[:INCLUDES]->(:Track)-[:IS_PLACEMENT_OF]->(lsr:LabelSoundRecording)<-[lsrToGsr:REPRESENTS]-(gsr:GlobalSoundRecording)
                    WHERE lsr.subaccountId <> pr.subaccountId
                    RETURN pr, lsr, lsrToGsr, gsr
                ",
                "
                    MERGE (nlsr:LabelSoundRecording:Orchard {isrc: lsr.isrc, vendorId: pr.vendorId, subaccountId: pr.subaccountId})
                        ON CREATE SET
                            nlsr.id = apoc.create.uuid(),
                            nlsr.createdAt = datetime(),
                            nlsr.createdBy = 'database/KDH-156_vendor_to_d3_p2:22'
                        SET nlsr += apoc.map.removeKeys(lsr, ['id', 'isrc', 'vendorId', 'subaccountId', 'createdAt', 'createdBy']),
                            nlsr.lastModifiedAt = datetime(),
                            nlsr.lastModifiedBy = 'database/KDH-156_vendor_to_d3_p2:22'
                    WITH *
                    CALL apoc.merge.relationship(gsr, type(lsrToGsr), null, lsrToGsr, nlsr)
                    YIELD rel
                    RETURN true
                ",
                {batchSize:1, iterateList:true, parallel:false, params: {project_id: toInteger(event.PROJECT_ID)}}
                )
                YIELD total, failedOperations, errorMessages, failedBatches, batch
                RETURN total, failedOperations, errorMessages, failedBatches, batch;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:23" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                CALL apoc.periodic.iterate(
                "
                    MATCH (pr:Project {id: $project_id})-[:INCLUDES]->(:Product)-[:INCLUDES]->(t:Track)-[lsrToT:IS_PLACEMENT_OF]->(lsr:LabelSoundRecording)
                    WHERE lsr.subaccountId <> pr.subaccountId
                    RETURN pr, lsr, lsrToT, t
                ",
                "
                    MERGE (nlsr:LabelSoundRecording:Orchard {isrc: lsr.isrc, vendorId: pr.vendorId, subaccountId: pr.subaccountId})
                        ON CREATE SET
                            nlsr.id = apoc.create.uuid(),
                            nlsr.createdAt = datetime(),
                            nlsr.createdBy = 'database/KDH-156_vendor_to_d3_p2:23'
                        SET nlsr += apoc.map.removeKeys(lsr, ['id', 'isrc', 'vendorId', 'subaccountId', 'createdAt', 'createdBy']),
                            nlsr.lastModifiedAt = datetime(),
                            nlsr.lastModifiedBy = 'database/KDH-156_vendor_to_d3_p2:23'
                    WITH *
                    CALL apoc.merge.relationship(t, type(lsrToT), null, lsrToT, nlsr)
                    YIELD rel
                    RETURN nlsr as labelSoundRecording
                ",
                {batchSize:1, iterateList:true, parallel:false, params: {project_id: toInteger(event.PROJECT_ID)}}
                )
                YIELD total, failedOperations, errorMessages, failedBatches, batch
                RETURN total, failedOperations, errorMessages, failedBatches, batch;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:24" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT PROJECT_ID
                FROM orchard_app_reporting_v2.art_relations_prod_art_relations.project
                WHERE project_id in (1910987, 2029849, 2066626, 2088730, 2185032, 2384922, 2892977, 2924388, 2932145, 2946653, 2974396, 2979234, 2984869, 2994781, 3032528, 3044598, 3044733, 3046399, 3049521, 3072485, 3150874, 3151199, 3157475, 3183145, 3185557, 3199948, 3210674, 3220499, 3220521, 3225043, 3228042, 3231595, 3231764, 3232356, 3233720, 3234902, 3234989, 3235036, 3235143, 3235178, 3235265, 3237775, 3251008, 3252427, 3252716, 3259122, 3271211, 3272510, 3295420, 3296116, 3305843, 3330087, 3333885, 3341556, 3346142, 3351650, 3352823, 3355208, 3360335, 3363775, 3364053, 3366563, 3376138, 3385980, 3391146, 3391788, 3401596, 3407049, 3408888, 3426458, 3444293, 3457594, 3469196, 3470741, 3471407, 3472075, 3482735, 3483368, 3491433, 3507879, 3510424, 3532007, 3541088, 3547709, 3549528, 3551570, 3563097, 3568187, 3633242, 3633243, 3633250, 3633252, 3655624, 3714071, 3716124, 3716125, 3716129, 3716446, 3719655, 3719994, 3720602, 3736631, 3748828, 3754003, 3759990, 3762613, 3764527, 3766912, 3768918, 3772969, 3776894, 3784028, 3785048, 3800115, 3800116, 3800117, 3847702, 3852513, 3854614, 3888312, 3888775, 3923195, 3933513, 3965275, 4010477, 4103180, 4150453, 4150492, 4152437, 4157464, 4157540, 4172844, 4180812, 4184954, 4185469, 4200081, 4202574, 4204274, 4206189, 4231608, 4237065, 4237641, 4243721, 4247663, 4255991, 4263819, 4267636, 4270776, 4315610, 4331623, 4332831, 4332921, 4333174, 4333342, 4333348, 4333350, 4338978, 4341029, 4341038, 4341297, 4341340, 4341356, 4341364, 4342932, 4342964, 4349806, 4358752, 4365587, 4368028, 4368035, 4368059, 4368060, 4368062, 4368189, 4368209, 4368221, 4369819, 4369851, 4369885, 4374054, 4374088, 4380906, 4389422, 4389473, 4391607, 4391613, 4401857, 4403969, 4409582, 4411487, 4412645, 4426594, 4436164, 4437665, 4439800, 4449187, 4464116, 4584180, 4600259, 4600284, 4608308, 4624292, 4641649, 4652218, 4658933, 4660611, 4685131, 4685137, 4699893, 4714916, 4727206, 4739189, 4740058, 4752445, 4759617, 4759631, 4765570, 4770495, 4799279, 4802019, 4807380, 4817784, 4818309, 4818371, 4818374, 4818379, 4818382, 4818388, 4818479, 4818482, 4818484, 4818491, 4818494, 4818498, 4818503, 4818507, 4818511, 4818810, 4818827, 4818833, 4818841, 4818856, 4818866, 4818872, 4818882, 4818952, 4819010, 4819017, 4819022, 4819029, 4819032, 4819055, 4819061, 4819065, 4819067, 4819068, 4819072, 4819075, 4819078, 4819085, 4819091, 4819094, 4819102, 4819110, 4819976, 4819981, 4819991, 4819993, 4820654, 4820655, 4820656, 4820659, 4820664, 4820665, 4820667, 4820669, 4820672, 4820673, 4820676, 4820679, 4820684, 4820686, 4821588, 4821592, 4821600, 4821611, 4821624, 4821741, 4821744, 4821746, 4821747, 4821751, 4821753, 4821756, 4821757, 4821758, 4821781, 4821787, 4821807, 4821815, 4821820, 4821827, 4821830, 4821852, 4821856, 4822354, 4822427, 4823037, 4832049, 4836117, 4837465, 4838720, 4841567, 4842945, 4849335, 4853636, 4854972, 4864354, 4869525, 4869573, 4963798, 5008354, 5019023, 5021999, 5026877, 5028204, 5029039, 5029051, 5029060, 5029170, 5029190, 5029192, 5029194, 5029199, 5029203, 5029818, 5030756, 5043173, 5043203, 5043952, 5048960, 5055466, 5067525, 5071627, 5071640, 5073399, 5081151, 5122722, 5248827, 5262698, 5263461, 5267411, 5268616, 5269928, 5270681, 5272968, 5277032, 5279107, 5279814, 5287077, 5290784, 5290801, 5319025, 5330733, 5334097, 5358412, 5360255, 5361724, 5362521, 5364953, 5370519, 5370522, 5375826, 5393201, 5394881, 5395331, 5395719, 5395857, 5418881, 5427283, 5436204, 5470379, 5480713, 5480714, 5480715, 5480717, 5480718, 5480719, 5480721, 5486127, 5491472, 5491736, 5501792, 5521199, 5588596, 5588604, 5593004, 5602753, 5602805, 5602835, 5602836, 5609092, 5609140, 5612811, 5615655, 5622454, 5623799, 5627773, 5633669, 5633679, 5637214, 5669032, 5740151, 5740155, 5740156, 5740160, 5740163, 5740169, 5740171, 5740175, 5740176, 5740178, 5740181, 5740184, 5740187, 5740190, 5740194, 5740195, 5740203, 5740205, 5740207, 5740209, 5740211, 5740212, 5740213, 5740215, 5740220, 5740221, 5740222, 5740224, 5740227, 5740229, 5740230, 5740234)
                ORDER BY project_id;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                MATCH (pr:Project {id: toInteger(event.PROJECT_ID)})-[:INCLUDES]->(:Product)-[:INCLUDES]->(:Track)-[lsrToT:IS_PLACEMENT_OF]->(lsr:LabelSoundRecording)
                WHERE lsr.subaccountId <> pr.subaccountId
                DELETE lsrToT;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:25" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT 1;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                MATCH (lp:LabelParticipant)<-[sahlp:HAS_LABEL_PARTICIPANT]-(sa:Subaccount)
                WHERE lp.vendorId in [16970, 18819, 22501, 25590, 26664, 32210, 35724, 75008] and lp.subaccountId <> sa.id
                DELETE sahlp;
            ]]>
        </cypherquery>
    </changeset>
    <changeset id="KDH-156_vendor_to_d3_p2:26" author="ssavva" run-always="true">
        <precondition>
            <sqlquery>
                SELECT 1;
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
                MATCH (lp:LabelParticipant)
                WHERE lp.vendorId in [16970, 18819, 22501, 25590, 26664, 32210, 35724, 75008] AND lp.subaccountId <> 0
                MATCH (v:Vendor)
                WHERE v.id = lp.vendorId
                MATCH (sa:Subaccount)
                WHERE sa.id = lp.subaccountId
                MERGE (v)-[vhlp:HAS_LABEL_PARTICIPANT]->(lp)
                    ON CREATE SET
                        vhlp.createdAt = datetime(),
                        vhlp.createdBy = 'database/KDH-156_vendor_to_d3_p2:26',
                        vhlp.lastModifiedAt = datetime(),
                        vhlp.lastModifiedBy = 'database/KDH-156_vendor_to_d3_p2:26'
                MERGE (sa)-[sahlp:HAS_LABEL_PARTICIPANT]->(lp)
                    ON CREATE SET
                        sahlp.createdAt = datetime(),
                        sahlp.createdBy = 'database/KDH-156_vendor_to_d3_p2:26',
                        sahlp.lastModifiedAt = datetime(),
                        sahlp.lastModifiedBy = 'database/KDH-156_vendor_to_d3_p2:26'
                RETURN true;
            ]]>
        </cypherquery>
    </changeset>
</changelog>
