<?xml version="1.0" encoding="UTF-8"?>
<changelog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./schema.xsd">
    <changeset id="PLATFORM-3905_backfill_labels_to_tier2:1" author="asampath" run-always="true">
        <cypherquery>
            <![CDATA[
	        MATCH(v:Vendor) WHERE v.vendorId IN [
                  34668, 34789, 34799, 34803, 34944, 34964, 34805,
                  34787, 74119, 72308, 34802, 34674, 34943, 34784,
                  34815, 34680, 34665, 34671, 34667, 34816, 34794,
                  34662, 34790, 34700, 34806, 34676, 34783, 34817,
                  34793, 34707, 34785, 34675, 35866, 34796, 34788,
                  34703, 34685, 34678, 34688, 34691, 34677, 34683,
                  34684, 34701, 34697, 34705, 34938, 34792, 34781,
                  34993, 34807, 34704, 34711, 34786, 34798, 34709,
                  34734, 34702, 34689, 34722, 34757, 34820, 34797,
                  34920, 34694, 34795, 34818, 34823, 34714, 34713,
                  34695, 34715, 34718, 34824, 34710, 34717, 34747,
                  34821, 34716, 34751, 34801, 34825, 34819, 34762,
                  34723, 34731, 34728, 34743, 34720, 34804, 34826,
                  34739, 34721, 34733, 34724, 34725, 34727, 34772,
                  34730, 34759, 34735, 34719, 34732, 34726, 34670,
                  34741, 34736, 34699, 34758, 34666, 34729, 34827,
                  34738, 34742, 34681, 34737, 34744, 34745, 34669,
                  34822, 34698, 34760, 34679, 34749, 34775, 34746,
                  34740, 34748, 34756, 34752, 34791]
	        OPTIONAL MATCH (v)-[old_rel:IN_SERVICE_TIER]->(:ServiceTier{displayName:'Tier 3'})
		  SET old_rel.updatedOn = localdatetime(), old_rel.updatedBy = 'Platform-3905'
		    WITH v, old_rel
                  CALL apoc.refactor.setType(old_rel, 'DELETED_IN_SERVICE_TIER')
                  YIELD input, output
                    WITH v
                MATCH (s:ServiceTier{displayName:'Tier 2'})
                MERGE (v)-[rel:IN_SERVICE_TIER]->(s)
		SET rel.createdAt = localdatetime(), rel.createdBy = 'Platform-3905',
		    rel.updatedOn = localdatetime(), rel.updatedBy = 'Platform-3905'
                RETURN v, s
	   ]]>
        </cypherquery>
    </changeset>
</changelog>
