<?xml version="1.0" encoding="UTF-8"?>
<changelog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:/var/app/InputFileSchema.xsd">
    <changeset id="ACC-7837-add-schedule-id-qa:1" author="anavalu" neo4j-server="nr-graph" run-always="true">
        <precondition>
            <sqlquery>
                <![CDATA[
                    SELECT s.schedule_id AS SCHEDULE_ID, sa.target_id AS CONTRIBUTION_ID
                    FROM ORCHARD_APP_REPORTING_V2.QA_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.SCHEDULE s
                    JOIN ORCHARD_APP_REPORTING_V2.QA_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.SCHEDULE_ATTACHMENT sa ON sa.schedule_id=s.schedule_id
                    WHERE s.schedule_id in ('6168', '6169', '6170', '6171') and sa.target_type='contribution' and sa.deleted_at IS NULL and sa.deleted_by IS NULL;
                ]]>
            </sqlquery>
        </precondition>
        <cypherquery>
            <![CDATA[
               MATCH (n:NrContribution {id:event.CONTRIBUTION_ID})
               SET 
                   n.abacusScheduleId=toInteger(event.SCHEDULE_ID),
                   n.lastModifiedAt=datetime(),
                   n.lastModifiedBy='database/ACC-7837-add-schedule-id'
            ]]>
        </cypherquery>
    </changeset>
</changelog>
