<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
                   xmlns:neo4j="http://www.liquibase.org/xml/ns/dbchangelog-ext"
                   xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
    <changeSet id="NO-TICKET_fix_Takuya_Ishikawa_access:1" author="aoshomoji">
        <neo4j:cypher>
            <![CDATA[
                MATCH (i:Identity {id: 'c03b7175-e406-434e-bd9d-f248952c0b6c' })-[:HAS_PROFILE]-(profile:Profile {profileType: "InsightsProfile"})-[oldRel:HAS_ACCESS_TO]->(v:Vendor {vendorId: 55661})
                MERGE (profile)-[:DELETED_HAS_ACCESS_TO]->(v)
                DELETE oldRel
            ]]>
        </neo4j:cypher>
    </changeSet>
    <changeSet id="NO-TICKET_fix_Takuya_Ishikawa_access:2" author="aoshomoji">
        <neo4j:cypher>
            <![CDATA[
                MATCH (i:Identity {id: 'c03b7175-e406-434e-bd9d-f248952c0b6c' })-[:HAS_PROFILE]-(profile:Profile {profileType: "InsightsProfile"})-[oldRel:HAS_ACCESS_TO]->(v:Vendor {vendorId: 78280})
                MERGE (profile)-[:DELETED_HAS_ACCESS_TO]->(v)
                DELETE oldRel
            ]]>
        </neo4j:cypher>
    </changeSet>
    <changeSet id="NO-TICKET_fix_Takuya_Ishikawa_access:3" author="aoshomoji">
        <neo4j:cypher>
            <![CDATA[
                MATCH (i:Identity {id: 'c03b7175-e406-434e-bd9d-f248952c0b6c' })-[:HAS_PROFILE]-(profile:Profile {profileType: "InsightsProfile"})-[oldRel:HAS_ACCESS_TO]->(v:Vendor {vendorId: 55637})
                MERGE (profile)-[:DELETED_HAS_ACCESS_TO]->(v)
                DELETE oldRel
            ]]>
        </neo4j:cypher>
    </changeSet>
    <changeSet id="NO-TICKET_fix_Takuya_Ishikawa_access:4" author="aoshomoji">
        <neo4j:cypher>
            <![CDATA[
                MATCH (i:Identity {id: 'c03b7175-e406-434e-bd9d-f248952c0b6c' })-[:HAS_PROFILE]-(profile:Profile {profileType: "InsightsProfile"})-[oldRel:HAS_ACCESS_TO]->(v:Vendor {vendorId: 34542})
                MERGE (profile)-[:DELETED_HAS_ACCESS_TO]->(v)
                DELETE oldRel
            ]]>
        </neo4j:cypher>
    </changeSet>
    <changeSet id="NO-TICKET_fix_Takuya_Ishikawa_access:5" author="aoshomoji">
        <neo4j:cypher>
            <![CDATA[
                MATCH (i:Identity {id: 'c03b7175-e406-434e-bd9d-f248952c0b6c' })-[:HAS_PROFILE]-(profile:Profile {profileType: "InsightsProfile"}),
                    (s1:SubAccount {id: 78280}),
                    (s2:SubAccount {id: 55637}),
                    (s3:SubAccount {id: 55661})
                MERGE (profile)-[:HAS_ACCESS_TO]->(s1)
                MERGE (profile)-[:HAS_ACCESS_TO]->(s2)
                MERGE (profile)-[:HAS_ACCESS_TO]->(s3)
            ]]>
        </neo4j:cypher>
    </changeSet>
</databaseChangeLog>
