<?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-544_create_missing_lsr:1" author="savva" run-on-change="true">
        <query>
            MATCH (pr:Project)-[:INCLUDES]->(p:Product)-[:INCLUDES]->(t:Track)
            WHERE t.id in [32077304, 29911638, 32212739, 31866997, 29900026, 32329492, 31250047, 31866737, 25576920, 29621137, 31866552, 31867021, 31866606]
                AND t.isrc =~ '^[A-Za-z]{2}[0-9A-Za-z]{3}[0-9]{2}[0-9]{5}$'
            MERGE (sr:LabelSoundRecording:Orchard {
                    isrc: toUpper(t.isrc),
                    vendorId: pr.vendorId,
                    subaccountId: pr.subaccountId
                }
            )
                ON CREATE SET
                    sr.id = apoc.create.uuid(),
                    sr.createdAt = datetime()
                SET
                    sr.name = t.name,
                    sr.modifiedAt = datetime(),
                    sr.version = t.version
            MERGE (t)-[:IS_PLACEMENT_OF]->(sr)
        </query>
    </changeset>
</changelog>
