<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
                   xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
                   xmlns:pro="http://www.liquibase.org/xml/ns/pro"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
    http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
    http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
    <property name="moderationModule" value="(SELECT id FROM module WHERE name = 'moderation')"/>
    <property name="moderationFeature" value="(SELECT id FROM feature WHERE key = 'moderation')"/>
    <property name="warningsFeature" value="(SELECT id FROM feature WHERE key = 'warnings')"/>
    <property name="loggingFeature" value="(SELECT id FROM feature WHERE key = 'logging')"/>
    <property name="mutingFeature" value="(SELECT id FROM feature WHERE key = 'muting')"/>
    <property name="warnDecayFeature" value="(SELECT id FROM feature WHERE key = 'warnDecay')"/>
    <property name="userNotesFeature" value="(SELECT id FROM feature WHERE key = 'userNotes')"/>

    <changeSet  author="Sheldan"  id="moderation_moderation-commands">
        <insert tableName="command">
            <column name="name" value="ban"/>
            <column name="module_id" valueComputed="${moderationModule}"/>
            <column name="feature_id" valueComputed="${moderationFeature}"/>
        </insert>
        <insert tableName="command">
            <column name="name" value="kick"/>
            <column name="module_id" valueComputed="${moderationModule}"/>
            <column name="feature_id" valueComputed="${moderationFeature}"/>
        </insert>
        <insert tableName="command">
            <column name="name" value="purge"/>
            <column name="module_id" valueComputed="${moderationModule}"/>
            <column name="feature_id" valueComputed="${moderationFeature}"/>
        </insert>
        <insert tableName="command">
            <column name="name" value="slowMode"/>
            <column name="module_id" valueComputed="${moderationModule}"/>
            <column name="feature_id" valueComputed="${moderationFeature}"/>
        </insert>
    </changeSet>

    <changeSet  author="Sheldan"  id="moderation_warnings-commands">
        <insert tableName="command">
            <column name="name" value="deleteWarning"/>
            <column name="module_id" valueComputed="${moderationModule}"/>
            <column name="feature_id" valueComputed="${warningsFeature}"/>
        </insert>
        <insert tableName="command">
            <column name="name" value="decayAllWarnings"/>
            <column name="module_id" valueComputed="${moderationModule}"/>
            <column name="feature_id" valueComputed="${warningsFeature}"/>
        </insert>
        <insert tableName="command">
            <column name="name" value="myWarnings"/>
            <column name="module_id" valueComputed="${moderationModule}"/>
            <column name="feature_id" valueComputed="${warningsFeature}"/>
        </insert>
        <insert tableName="command">
            <column name="name" value="warn"/>
            <column name="module_id" valueComputed="${moderationModule}"/>
            <column name="feature_id" valueComputed="${warningsFeature}"/>
        </insert>
        <insert tableName="command">
            <column name="name" value="warnings"/>
            <column name="module_id" valueComputed="${moderationModule}"/>
            <column name="feature_id" valueComputed="${warningsFeature}"/>
        </insert>
    </changeSet>

    <changeSet  author="Sheldan"  id="moderation_muting-commands">
        <insert tableName="command">
            <column name="name" value="mute"/>
            <column name="module_id" valueComputed="${moderationModule}"/>
            <column name="feature_id" valueComputed="${mutingFeature}"/>
        </insert>
        <insert tableName="command">
            <column name="name" value="setMuteRole"/>
            <column name="module_id" valueComputed="${moderationModule}"/>
            <column name="feature_id" valueComputed="${mutingFeature}"/>
        </insert>
        <insert tableName="command">
            <column name="name" value="unMute"/>
            <column name="module_id" valueComputed="${moderationModule}"/>
            <column name="feature_id" valueComputed="${mutingFeature}"/>
        </insert>
    </changeSet>

    <changeSet  author="Sheldan"  id="moderation_warnDecay-commands">
        <insert tableName="command">
            <column name="name" value="decayWarnings"/>
            <column name="module_id" valueComputed="${moderationModule}"/>
            <column name="feature_id" valueComputed="${warnDecayFeature}"/>
        </insert>
    </changeSet>

    <changeSet  author="Sheldan"  id="moderation_userNotes-commands">
        <insert tableName="command">
            <column name="name" value="deleteNote"/>
            <column name="module_id" valueComputed="${moderationModule}"/>
            <column name="feature_id" valueComputed="${userNotesFeature}"/>
        </insert>
        <insert tableName="command">
            <column name="name" value="userNote"/>
            <column name="module_id" valueComputed="${moderationModule}"/>
            <column name="feature_id" valueComputed="${userNotesFeature}"/>
        </insert>
        <insert tableName="command">
            <column name="name" value="userNotes"/>
            <column name="module_id" valueComputed="${moderationModule}"/>
            <column name="feature_id" valueComputed="${userNotesFeature}"/>
        </insert>
    </changeSet>

</databaseChangeLog>