<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9
                      http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">

 	<changeSet id="0001" author="d.ivanov">
		<comment>fix parent org unit</comment>
    <sql>
			UPDATE security.org_unit ou
			SET parent_id = pou.id
			FROM public.recruitment r
			JOIN security.org_unit pou on pou.code = r.parent_id
			WHERE ou.code = r.idm_id;
		</sql>
	</changeSet>
	
</databaseChangeLog>