<?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="201509011514" author="Preethi,Sourav">
        <preConditions onFail="MARK_RAN">
            <sqlCheck expectedResult="0">
                select count(*) from site_information where name='defaultOrganizationName';
            </sqlCheck>
        </preConditions>
        <comment>Add default organization name for openelis</comment>
        <sql>
            INSERT INTO site_information(id, name, lastupdated, description, value, encrypted, value_type)  VALUES ( nextVal( 'site_information_seq' ) , 'defaultOrganizationName', now(), 'Default organization name for department to be synced from openmrs',  'Bahmni', 'f', 'text' );
        </sql>
    </changeSet>
    <changeSet id="201510121504" author="Preethi,Sourav">
        <preConditions onFail="MARK_RAN">
            <sqlCheck expectedResult="0">
                select count(*) from organization where name='Bahmni';
            </sqlCheck>
        </preConditions>
        <comment>Add Bahmni organization</comment>
        <sql>
            INSERT INTO organization(id, name)  VALUES ( nextVal( 'organization_seq' ) , 'Bahmni' );
        </sql>
    </changeSet>
    <changeSet id="201603021148" author="Preethi,Vikash">
        <comment>Update Active Flag for Bahmni Organization</comment>
        <sql>
            update organization set is_active='Y' where name='Bahmni';
        </sql>
    </changeSet>
</databaseChangeLog>