<?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="pshrivastava">
        <sql dbms="mysql" endDelimiter=";;" splitStatements="true" stripComments="true">
            SET @privilegeId = (SELECT orchadmin_privilege_id FROM orchadmin_privileges WHERE privilege = 'ajaxcsvexport');;
                        
            UPDATE orchadmin_privileges SET privilege = 'exportreleasesearchresult' 
            WHERE orchadmin_privilege_id = @privilegeId;;
            
            UPDATE orchadmin_permissions SET description = 'Export release search result'
            WHERE orchadmin_privilege_id = @privilegeId;;
        </sql>
        <rollback>
            <sql dbms="mysql" endDelimiter=";;" splitStatements="true" stripComments="true">
                SET @privilegeId = (SELECT orchadmin_privilege_id FROM orchadmin_privileges WHERE privilege = "exportreleasesearchresult");;
                
                UPDATE orchadmin_privileges SET privilege = 'ajaxcsvexport'
                WHERE orchadmin_privilege_id = @privilegeId;;
                
                UPDATE orchadmin_permissions SET description = 'Export search release result in csv'
                WHERE orchadmin_privilege_id = @privilegeId;;
            </sql>
        </rollback>
    </changeSet>
</databaseChangeLog>
