<?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="gauravshrivastav">
        <sql dbms="mysql" endDelimiter=";;" splitStatements="true" stripComments="true">
            INSERT INTO features (feature_name) VALUES("Localizations");;
            SET @feature_id = LAST_INSERT_ID();;

            INSERT INTO ui_restrictions (feature_id, other, other_path, description, date_created) VALUES (@feature_id,"localizations","application/modules/alw/controllers/ReleaseBuilderController.php","Enable localizations on per label basis", CURRENT_TIMESTAMP);;
        
            INSERT INTO vendor_restricted_features(vendor_id, feature_id)
            (SELECT vendor_id, @feature_id FROM vendor WHERE vendor_id NOT IN (7123,16156,17292,23502,22732,22264,23500,9461));;
        
        </sql>
        <rollback>
            SET @feature_id := (SELECT feature_id FROM features WHERE feature_name = "Localizations");;
            DELETE FROM vendor_restricted_features WHERE feature_id = @feature_id;;
            DELETE FROM ui_restrictions WHERE feature_id = @feature_id;;
            DELETE FROM features WHERE feature_id = @feature_id;;
        </rollback>
    </changeSet>
</databaseChangeLog>
