<?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="PLATFORM-2095_vendor_attributes:1" author="npatel" run-on-change="true">
         <query>
           CALL apoc.periodic.iterate(
                "
                    WITH 'mysql_artrelations' as url_alias,
                    '
                        SELECT vendor_id, is_distributor, coalesce(company, name) as company_name, status
                        FROM vendor
                    ' as sql
                    CALL apoc.load.jdbc(url_alias, sql)
                    YIELD row
                    RETURN row
                ",
                "
                    MERGE (v:Vendor { id: toInteger(row.vendor_id) })
                    SET  v.name = row.company_name,
                        v.isDistributor = row.is_distributor,
                        v.status = row.status
                ",
                {batchSize:1000}
            );
        </query>
    </changeset>

</changelog>
