<?xml version="1.0" encoding="UTF-8"?>
<changelog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.liquigraph.org/schema/1.0/liquigraph.xsd">
    <changeset id="ARTARCH-568_fix_mislinked_subaccounts:1" author="owright" run-on-change="true">
        <query>
            <![CDATA[
                WITH
                    'mysql_artrelations' as url_alias,
                    '
                        SELECT subaccount_id, vendor_id FROM art_relations.subaccount WHERE subaccount_id IN (
                            2253,
                            3399,
                            4413,
                            13155,
                            13206,
                            13207,
                            13299,
                            13328,
                            13422,
                            13474,
                            13475,
                            13795,
                            13947,
                            14179,
                            14180,
                            14466,
                            14467,
                            14506,
                            14558,
                            14609,
                            14610,
                            14634,
                            14635,
                            15074,
                            15159,
                            15253,
                            15318,
                            15453,
                            17869
                        )
                    ' as sql
                CALL apoc.load.jdbc(url_alias, sql)
                YIELD row
                MATCH (:Vendor { id: toInteger(row.vendor_id) })-[:OWNS]->(:Subaccount { id: toInteger(row.subaccount_id) })<-[rel:OWNS]-(:Vendor)
                DELETE rel;
            ]]>
        </query>
    </changeset>
</changelog>
