<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
        xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:ext="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-3.0.xsd
        http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
    <changeSet id="1" author="cgorman">
        <sql dbms="mysql" endDelimiter=";;" splitStatements="true" stripComments="true">
        <![CDATA[
            DROP PROCEDURE IF EXISTS sp_get_jobs_for_delivery;;

            CREATE DEFINER='theorchard_dd'@'127.0.0.1' PROCEDURE sp_get_jobs_for_delivery(IN dmsId INT, IN limitTo INT, IN encoder_ids TEXT, IN isBatch BIT)

            BEGIN
                IF (isBatch = 1) THEN
                    CALL sp_get_jobs_for_batch_delivery(dmsId, encoder_ids);
                ELSE
                    CALL sp_get_jobs_for_nonbatch_delivery(dmsId, limitTo, encoder_ids);
                END IF;
            END;;
        ]]>
        </sql>
    </changeSet>
</databaseChangeLog>