added liquibase for setup of databases and initial values

fixed some table names to be singular
migrated templates to separate repository
added seed data to initial version in liquibase migrations instead of property files (post targets, emotes etc) and created some default tables containing those default values
added separate artifacts to be used containing only the liquibase config
added shell script as a wrapper for ansible deployment, to handle an environment variable defining whether or not the deployment should be executed
added logback scan period
added licenses for ansible, liquibase, docker and docker-compose
This commit is contained in:
Sheldan
2020-07-17 21:48:23 +02:00
parent e8767429bf
commit 9374dfb912
965 changed files with 15775 additions and 2935 deletions
@@ -0,0 +1,18 @@
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd">
<id>liquibase</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<outputDirectory>.</outputDirectory>
<directory>${project.basedir}/src/main/resources/migrations</directory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
</fileSets>
</assembly>
@@ -1,10 +0,0 @@
package dev.sheldan.abstracto.moderation.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
@Configuration
@PropertySource("classpath:moderation.properties")
public class ModerationConfig {
}
@@ -1,26 +0,0 @@
package dev.sheldan.abstracto.moderation.listener;
import dev.sheldan.abstracto.core.service.management.DefaultConfigManagementService;
import dev.sheldan.abstracto.moderation.config.features.WarningDecayFeature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@Component
public class ModerationDefaultConfigListener {
@Autowired
private DefaultConfigManagementService defaultConfigManagementService;
@Value("${abstracto.warnings.warnDecay.days}")
private Long decayDays;
@EventListener
@Transactional
public void handleContextRefreshEvent(ContextRefreshedEvent ctxStartEvt) {
defaultConfigManagementService.createDefaultConfig(WarningDecayFeature.DECAY_DAYS_KEY, decayDays);
}
}
@@ -3,6 +3,8 @@ package dev.sheldan.abstracto.moderation.listener;
import dev.sheldan.abstracto.core.listener.ServerConfigListener;
import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.abstracto.core.service.management.ConfigManagementService;
import dev.sheldan.abstracto.core.service.management.DefaultConfigManagementService;
import dev.sheldan.abstracto.moderation.config.features.WarningDecayFeature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@@ -13,11 +15,11 @@ public class WarnDecayConfigListener implements ServerConfigListener {
@Autowired
private ConfigManagementService configManagementService;
@Value("${abstracto.warnings.warnDecay.days}")
private Long decayDays;
@Autowired
private DefaultConfigManagementService defaultConfigManagementService;
@Override
public void updateServerConfig(AServer server) {
configManagementService.createIfNotExists(server.getId(), "decayDays", decayDays);
configManagementService.createIfNotExists(server.getId(), WarningDecayFeature.DECAY_DAYS_KEY, defaultConfigManagementService.getDefaultConfig(WarningDecayFeature.DECAY_DAYS_KEY).getLongValue());
}
}
@@ -0,0 +1,11 @@
<?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-3.8.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext ../dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/pro ../dbchangelog-3.8.xsd" >
<include file="moderation-tables/tables.xml" relativeToChangelogFile="true"/>
<include file="moderation-seedData/data.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
@@ -0,0 +1,134 @@
<?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-3.8.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.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')"/>
<property name="today" value="(SELECT NOW())"/>
<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}"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="command">
<column name="name" value="banId"/>
<column name="module_id" valueComputed="${moderationModule}"/>
<column name="feature_id" valueComputed="${moderationFeature}"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="command">
<column name="name" value="kick"/>
<column name="module_id" valueComputed="${moderationModule}"/>
<column name="feature_id" valueComputed="${moderationFeature}"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="command">
<column name="name" value="purge"/>
<column name="module_id" valueComputed="${moderationModule}"/>
<column name="feature_id" valueComputed="${moderationFeature}"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="command">
<column name="name" value="slowMode"/>
<column name="module_id" valueComputed="${moderationModule}"/>
<column name="feature_id" valueComputed="${moderationFeature}"/>
<column name="created" valueComputed="${today}"/>
</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}"/>
<column name="created" valueComputed="${today}"/>
</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}"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="command">
<column name="name" value="warn"/>
<column name="module_id" valueComputed="${moderationModule}"/>
<column name="feature_id" valueComputed="${warningsFeature}"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="command">
<column name="name" value="warnings"/>
<column name="module_id" valueComputed="${moderationModule}"/>
<column name="feature_id" valueComputed="${warningsFeature}"/>
<column name="created" valueComputed="${today}"/>
</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}"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="command">
<column name="name" value="setMuteRole"/>
<column name="module_id" valueComputed="${moderationModule}"/>
<column name="feature_id" valueComputed="${mutingFeature}"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="command">
<column name="name" value="unMute"/>
<column name="module_id" valueComputed="${moderationModule}"/>
<column name="feature_id" valueComputed="${mutingFeature}"/>
<column name="created" valueComputed="${today}"/>
</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}"/>
<column name="created" valueComputed="${today}"/>
</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}"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="command">
<column name="name" value="userNote"/>
<column name="module_id" valueComputed="${moderationModule}"/>
<column name="feature_id" valueComputed="${userNotesFeature}"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="command">
<column name="name" value="userNotes"/>
<column name="module_id" valueComputed="${moderationModule}"/>
<column name="feature_id" valueComputed="${userNotesFeature}"/>
<column name="created" valueComputed="${today}"/>
</insert>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,17 @@
<?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-3.8.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
<include file="default_config.xml" relativeToChangelogFile="true"/>
<include file="un_mute_job.xml" relativeToChangelogFile="true"/>
<include file="module.xml" relativeToChangelogFile="true"/>
<include file="warn_decay_job.xml" relativeToChangelogFile="true"/>
<include file="feature.xml" relativeToChangelogFile="true"/>
<include file="default_posttarget.xml" relativeToChangelogFile="true"/>
<include file="default_feature_flag.xml" relativeToChangelogFile="true"/>
<include file="command.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
@@ -0,0 +1,19 @@
<?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-3.8.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd">
<property name="today" value="(SELECT NOW())"/>
<changeSet author="Sheldan" id="moderation_default_config-insert">
<insert tableName="default_config">
<column name="name" value="decayDays"/>
<column name="long_value" value="90"/>
<column name="created" valueComputed="${today}"/>
</insert>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,48 @@
<?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-3.8.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
<property name="moderationFeature" value="(SELECT id FROM feature WHERE key = 'moderation')"/>
<property name="warningsFeature" value="(SELECT id FROM feature WHERE key = 'warnings')"/>
<property name="warnDecayFeature" value="(SELECT id FROM feature WHERE key = 'warnDecay')"/>
<property name="loggingFeature" value="(SELECT id FROM feature WHERE key = 'logging')"/>
<property name="mutingFeature" value="(SELECT id FROM feature WHERE key = 'muting')"/>
<property name="userNotesFeature" value="(SELECT id FROM feature WHERE key = 'userNotes')"/>
<property name="today" value="(SELECT NOW())"/>
<changeSet author="Sheldan" id="moderation_default_feature_flag-insertion">
<insert tableName="default_feature_flag">
<column name="enabled" value="false"/>
<column name="feature_id" valueComputed="${moderationFeature}" />
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="default_feature_flag">
<column name="enabled" value="false"/>
<column name="feature_id" valueComputed="${warningsFeature}" />
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="default_feature_flag">
<column name="enabled" value="false"/>
<column name="feature_id" valueComputed="${warnDecayFeature}" />
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="default_feature_flag">
<column name="enabled" value="false"/>
<column name="feature_id" valueComputed="${loggingFeature}" />
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="default_feature_flag">
<column name="enabled" value="false"/>
<column name="feature_id" valueComputed="${mutingFeature}" />
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="default_feature_flag">
<column name="enabled" value="false"/>
<column name="feature_id" valueComputed="${userNotesFeature}" />
<column name="created" valueComputed="${today}"/>
</insert>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,48 @@
<?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-3.8.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
<property name="today" value="(SELECT NOW())"/>
<changeSet author="Sheldan" id="moderation_default_posttarget-insertion">
<insert tableName="default_posttarget">
<column name="name" value="joinLog"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="default_posttarget">
<column name="name" value="leaveLog"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="default_posttarget">
<column name="name" value="warnLog"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="default_posttarget">
<column name="name" value="kickLog"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="default_posttarget">
<column name="name" value="banLog"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="default_posttarget">
<column name="name" value="editLog"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="default_posttarget">
<column name="name" value="deleteLog"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="default_posttarget">
<column name="name" value="muteLog"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="default_posttarget">
<column name="name" value="decayLog"/>
<column name="created" valueComputed="${today}"/>
</insert>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,36 @@
<?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-3.8.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
<property name="today" value="(SELECT NOW())"/>
<changeSet author="Sheldan" id="moderation_feature-insertion">
<insert tableName="feature">
<column name="key" value="moderation"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="feature">
<column name="key" value="warnings"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="feature">
<column name="key" value="warnDecay"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="feature">
<column name="key" value="logging"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="feature">
<column name="key" value="muting"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="feature">
<column name="key" value="userNotes"/>
<column name="created" valueComputed="${today}"/>
</insert>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,16 @@
<?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-3.8.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
<property name="today" value="(SELECT NOW())"/>
<changeSet author="Sheldan" id="moderation-module-insertion">
<insert tableName="module">
<column name="name" value="moderation"/>
<column name="created" valueComputed="${today}"/>
</insert>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,18 @@
<?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-3.8.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
<changeSet author="Sheldan" id="un-mute-job-insert">
<insert tableName="scheduler_job">
<column name="name" value="unMuteJob"/>
<column name="group_name" value="moderation"/>
<column name="clazz" value="dev.sheldan.abstracto.moderation.job.UnMuteJob"/>
<column name="active" value="true"/>
<column name="recovery" value="false"/>
</insert>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,19 @@
<?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-3.8.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
<changeSet author="Sheldan" id="warn-decay-job-insert">
<insert tableName="scheduler_job">
<column name="name" value="warnDecayJob"/>
<column name="group_name" value="moderation"/>
<column name="clazz" value="dev.sheldan.abstracto.moderation.job.WarnDecayJob"/>
<column name="active" value="true"/>
<column name="cron_expression" value="0 0 * * * ?"/>
<column name="recovery" value="false"/>
</insert>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,51 @@
<?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-3.8.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
<changeSet author="Sheldan" id="mute-table">
<createTable tableName="mute">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="mute_pkey"/>
</column>
<column name="created" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="reason" type="VARCHAR(255)"/>
<column name="trigger_key" type="VARCHAR(255)"/>
<column name="updated" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="mute_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="mute_target_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="muted_user" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="muting_channel" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="muting_server" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="mute_ended" type="BOOLEAN"/>
<column name="message_id" type="BIGINT"/>
<column name="muting_user" type="BIGINT">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="Sheldan" id="mute-fk_mute_channel">
<addForeignKeyConstraint baseColumnNames="muting_channel" baseTableName="mute" constraintName="fk_mute_channel" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableName="channel" validate="true"/>
</changeSet>
<changeSet author="Sheldan" id="mute-fk_mute_muting_user">
<addForeignKeyConstraint baseColumnNames="muting_user" baseTableName="mute" constraintName="fk_mute_muting_user" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="user_in_server_id" referencedTableName="user_in_server" validate="true"/>
</changeSet>
<changeSet author="Sheldan" id="mute-fk_mute_muted_user">
<addForeignKeyConstraint baseColumnNames="muted_user" baseTableName="mute" constraintName="fk_mute_muted_user" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="user_in_server_id" referencedTableName="user_in_server" validate="true"/>
</changeSet>
<changeSet author="Sheldan" id="mute-fk_mute_muting_server">
<addForeignKeyConstraint baseColumnNames="muting_server" baseTableName="mute" constraintName="fk_mute_muting_server" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableName="server" validate="true"/>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,35 @@
<?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-3.8.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
<changeSet author="Sheldan" id="mute_role-table">
<createTable tableName="mute_role">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="mute_role_pkey"/>
</column>
<column name="created" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="updated" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="role_id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="server_id" type="BIGINT">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="Sheldan" id="1593469295954-78">
<addForeignKeyConstraint baseColumnNames="role_id" baseTableName="mute_role" constraintName="fk3m21mnle06e53wb4r1x5bfyxc" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableName="role" validate="true"/>
</changeSet>
<changeSet author="Sheldan" id="1593469295954-126">
<addForeignKeyConstraint baseColumnNames="server_id" baseTableName="mute_role" constraintName="fk8bveij4p6lnc2fkoascaeb28k" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableName="server" validate="true"/>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,13 @@
<?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-3.8.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
<include file="mute.xml" relativeToChangelogFile="true"/>
<include file="mute_role.xml" relativeToChangelogFile="true"/>
<include file="user_note.xml" relativeToChangelogFile="true"/>
<include file="warning.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
@@ -0,0 +1,26 @@
<?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-3.8.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
<changeSet author="Sheldan" id="user_note-table">
<createTable tableName="user_note">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="user_note_pkey"/>
</column>
<column name="created" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="note" type="VARCHAR(2000)"/>
<column name="note_user" type="BIGINT">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="Sheldan" id="user_note-fk_user_note_user">
<addForeignKeyConstraint baseColumnNames="note_user" baseTableName="user_note" constraintName="fk_user_note_user" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="user_in_server_id" referencedTableName="user_in_server" validate="true"/>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,36 @@
<?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-3.8.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
<changeSet author="Sheldan" id="warning-table">
<createTable tableName="warning">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="warning_pkey"/>
</column>
<column name="created" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="decay_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="decayed" type="BOOLEAN"/>
<column name="reason" type="VARCHAR(255)"/>
<column name="updated" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="warn_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="warned_user_id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="warning_user_id" type="BIGINT">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="Sheldan" id="warning-fk_warning_warned_user">
<addForeignKeyConstraint baseColumnNames="warned_user_id" baseTableName="warning" constraintName="fk_warning_warned_user" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="user_in_server_id" referencedTableName="user_in_server" validate="true"/>
</changeSet>
<changeSet author="Sheldan" id="warning-fk_warning_warning_user">
<addForeignKeyConstraint baseColumnNames="warning_user_id" baseTableName="warning" constraintName="fk_warning_warning_user" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="user_in_server_id" referencedTableName="user_in_server" validate="true"/>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,10 @@
<?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-3.8.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/pro dbchangelog-3.8.xsd" >
<include file="1.0-moderation/collection.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
@@ -1,23 +0,0 @@
abstracto.postTargets.moderation=joinLog,leaveLog,warnLog,kickLog,banLog,editLog,deleteLog,muteLog,decayLog
abstracto.features.moderation.enabled=false
abstracto.features.warnings.enabled=false
abstracto.features.warnDecay.enabled=false
abstracto.features.logging.enabled=false
abstracto.features.muting.enabled=false
abstracto.features.userNotes.enabled=false
abstracto.warnings.warnDecay.days=90
abstracto.scheduling.jobs.unMuteJob.name=unMuteJob
abstracto.scheduling.jobs.unMuteJob.group=moderation
abstracto.scheduling.jobs.unMuteJob.clazz=dev.sheldan.abstracto.moderation.job.UnMuteJob
abstracto.scheduling.jobs.unMuteJob.standAlone=false
abstracto.scheduling.jobs.unMuteJob.active=true
abstracto.scheduling.jobs.unMuteJob.recovery=false
abstracto.scheduling.jobs.warnDecayJob.name=warnDecayJob
abstracto.scheduling.jobs.warnDecayJob.group=moderation
abstracto.scheduling.jobs.warnDecayJob.clazz=dev.sheldan.abstracto.moderation.job.WarnDecayJob
abstracto.scheduling.jobs.warnDecayJob.standAlone=true
abstracto.scheduling.jobs.warnDecayJob.active=true
abstracto.scheduling.jobs.warnDecayJob.cronExpression=0 0 * * * ?
abstracto.scheduling.jobs.warnDecayJob.recovery=false
@@ -1,32 +0,0 @@
{
"author": {
"name": "${bannedUser.effectiveName}",
"avatar": "${bannedUser.user.effectiveAvatarUrl}"
},
"title": {
"title": "<#include "ban_log_title">"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"fields": [
{
"name": "<#include "ban_log_banned_user_field_title">",
"value": "${bannedUser.effectiveName} ${bannedUser.asMention} (${bannedUser.idLong?c})"
},
{
"name": "<#include "ban_log_banning_user_field_title">",
"value": "${banningUser.effectiveName} ${banningUser.asMention} (${banningUser.idLong?c})"
},
{
"name": "<#include "ban_log_jump_link_field_title">",
"value": "[${messageChannel.name}](${message.jumpUrl})"
},
{
"name": "<#include "ban_log_reason_field_title">",
"value": "${reason}"
}
]
}
@@ -1,28 +0,0 @@
{
"title": {
"title": "<#include "ban_log_title">"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"fields": [
{
"name": "<#include "ban_log_banned_user_field_title">",
"value": "${bannedUserId?c}"
},
{
"name": "<#include "ban_log_banning_user_field_title">",
"value": "${banningUser.effectiveName} ${banningUser.asMention} (${banningUser.idLong?c})"
},
{
"name": "<#include "ban_log_jump_link_field_title">",
"value": "[${messageChannel.name}](${message.jumpUrl})"
},
{
"name": "<#include "ban_log_reason_field_title">",
"value": "${reason}"
}
]
}
@@ -1,32 +0,0 @@
{
"author": {
"name": "${kickedUser.effectiveName}",
"avatar": "${kickedUser.user.effectiveAvatarUrl}"
},
"title": {
"title": "<#include "kick_log_title">"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"fields": [
{
"name": "<#include "kick_log_kicked_user_field_title">",
"value": "${kickedUser.effectiveName} ${kickedUser.asMention} (${kickedUser.idLong?c})"
},
{
"name": "<#include "kick_log_kicking_user_field_title">",
"value": "${kickingUser.effectiveName} ${kickingUser.asMention} (${kickingUser.idLong?c})"
},
{
"name": "<#include "kick_log_jump_link_field_title">",
"value": "[${messageChannel.name}](${message.jumpUrl})"
},
{
"name": "<#include "kick_log_reason_field_title">",
"value": "${reason}"
}
]
}
@@ -1,31 +0,0 @@
{
"author": {
<#if specifiedUser??>
"name": "${specifiedUser.member.effectiveName}",
"avatar": "${specifiedUser.member.user.effectiveAvatarUrl}"
<#else>
"name": "${member.effectiveName}",
"avatar": "${member.user.effectiveAvatarUrl}"
</#if>
},
"title": {
<#if specifiedUser??>
<#assign user>${specifiedUser.member.effectiveName}</#assign>
"title": "<#include "user_notes_embed_user_title">"
<#else>
"title": "<#include "user_notes_embed_title">"
</#if>
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"description": "<#list userNotes as note>
<#assign user>${note.fullUser.member.asMention}</#assign>
<#assign noteText>${note.note.note}</#assign>
<#assign noteId>${note.note.id}</#assign>
<#assign date>${formatDate(note.note.created, "yyyy-MM-dd HH:mm:ss")}</#assign>
<#include "user_notes_note_entry"><#else><#include "user_notes_no_notes">
</#list>"
}
@@ -1,44 +0,0 @@
{
"author": {
"name": "${mutedUser.effectiveName}",
"avatar": "${mutedUser.user.effectiveAvatarUrl}"
},
"title": {
"title": "<#include "mute_log_title">"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"fields": [
{
"name": "<#include "mute_log_muted_user_field_title">",
"value": "${mutedUser.effectiveName} ${mutedUser.asMention} (${mutedUser.idLong?c})"
},
{
"name": "<#include "mute_log_muting_user_field_title">",
"value": "${mutingUser.effectiveName} ${mutingUser.asMention} (${mutingUser.idLong?c})"
},
{
"name": "<#include "mute_log_mute_location_field_title">",
"value": "[${messageChannel.name}](${message.jumpUrl})"
},
{
"name": "<#include "mute_log_mute_reason_field_title">",
"value": "${mute.reason}"
},
{
"name": "<#include "mute_log_mute_duration_field_title">",
"value": "${fmtDuration(muteDuration)}"
},
{
"name": "<#include "mute_log_muted_until_field_title">",
"value": "${formatDate(mute.muteTargetDate, "yyyy-MM-dd HH:mm:ss")}"
}
],
"footer": {
"text": "<#include "mute_log_mute_id_footer"> #${mute.id}"
},
"timeStamp": "${mute.muteDate}"
}
@@ -1,55 +0,0 @@
{
<#if unMutedUser?has_content>
"author": {
"name": "${unMutedUser.effectiveName}",
"avatar": "${unMutedUser.user.effectiveAvatarUrl}"
},
</#if>
"title": {
"title": "<#include "unMute_log_title">"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"fields": [
{
"name": "<#include "unMute_log_unmuted_user_field_title">",
<#if unMutedUser?has_content>
"value": "${unMutedUser.effectiveName} ${unMutedUser.asMention} (${unMutedUser.idLong?c})"
<#else>
"value": "<#include "user_left_server"> (${mute.mutedUser.userReference.id?c})"
</#if>
},
{
"name": "<#include "mute_log_muting_user_field_title">",
<#if mutingUser?has_content>
"value": "${mutingUser.effectiveName} ${mutingUser.asMention} (${mutingUser.idLong?c})"
<#else>
"value": "<#include "user_left_server"> (${mute.mutingUser.userReference.id?c})"
</#if>
},
{
"name": "<#include "mute_log_mute_location_field_title">",
"value": "[Link](${messageUrl})"
},
{
"name": "<#include "unMute_log_muted_since_field_title">",
"value": "${formatDate(mute.muteDate, "yyyy-MM-dd HH:mm:ss")}"
},
{
"name": "<#include "mute_log_mute_duration_field_title">",
"value": "${fmtDuration(muteDuration)}"
},
{
"name": "<#include "mute_log_mute_reason_field_title">",
"value": "${mute.reason}"
}
],
"footer": {
"text": "<#include "mute_log_mute_id_footer"> #${mute.id}"
},
"timeStamp": "${unmuteDate}"
}
@@ -1,14 +0,0 @@
{
"author": {
"name": "${member.effectiveName}",
"avatar": "${member.user.effectiveAvatarUrl}"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
}
<#assign userMention>${member.effectiveName}</#assign>
,"description" :"<#include "myWarnings_with_decay_embed_description">"
</#if>
}
@@ -1 +0,0 @@
The slowmode in channel ${channel.name} has been set to ${channel.slowMode} seconds.
@@ -1,41 +0,0 @@
{
"author": {
"name": "${warnedUser.effectiveName}",
"avatar": "${warnedUser.user.effectiveAvatarUrl}"
},
"title": {
"title": "<#include "warn_log_title">"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"fields": [
{
"name": "<#include "warn_log_warned_user_field_title">",
"value": "${warnedUser.effectiveName} ${warnedUser.asMention} (${warnedUser.idLong?c})"
},
<#if warningUser?has_content>
{
"name": "<#include "warn_log_warning_user_field_title">",
"value": "${warningUser.effectiveName} ${warningUser.asMention} (${warningUser.idLong?c})"
},
</#if>
<#if warning?has_content>
{
"name": "<#include "warn_log_warn_location_field_title">",
"value": "[${messageChannel.name}](${message.jumpUrl})"
},
</#if>
{
"name": "<#include "warn_log_warn_reason_field_title">",
"value": "${reason}"
}
],
"footer": {
<#if warningUser?has_content>
"text": "<#include "warn_log_warn_id_footer"> #${warning.id}"
</#if>
}
}
@@ -1,7 +0,0 @@
{
<#assign warnCount>${warnings?size}</#assign>
"headerText": "<#include "warnings_header_text">",
"items": [
<#list warnings as warning>"<#include "warnings_warn_entry">"<#sep>,</#list>
]
}
@@ -1,11 +0,0 @@
<#assign warnId>${warning.warning.id}</#assign>
<#assign reason>${warning.warning.reason}</#assign>
<#assign warnedUserText><#if warning.warnedUser.member??>${warning.warnedUser.member.asMention}(${warning.warnedUser.member.user.id})<#else>${warning.warnedUser.aUserInAServer.id}</#if></#assign>
<#assign warningUserText><#if warning.warningUser.member??>${warning.warningUser.member.asMention}(${warning.warningUser.member.user.id})<#else>${warning.warningUser.aUserInAServer.id}</#if></#assign>
<#assign warnDate>${formatDate(warning.warning.warnDate, "yyyy-MM-dd HH:mm:ss")}</#assign>
<#include "warnings_warn_entry_text">
<#if warning.warning.decayed>
<#assign decayDate>${formatDate(warning.warning.decayDate, "yyyy-MM-dd HH:mm:ss")}</#assign>
<#include "warnings_warn_is_decayed">
</#if>
@@ -1,12 +0,0 @@
{
"imageUrl": "${imageUrl}",
"fields": [
{
"name": "<#include "messageDeleted_attachment_link_field_title">",
"value": "[<#include "messageDeleted_attachment_link_display_text">](${imageUrl})"
}
],
"footer": {
"text": "<#include "messageDeleted_attachment_footer"> #${counter}"
}
}
@@ -1,22 +0,0 @@
{
"author": {
"name": "${member.effectiveName}#${member.user.discriminator}",
"avatar": "${member.user.effectiveAvatarUrl}"
},
"description": "<#include "messageDeleted_description_text">",
"color" : {
"r": 200,
"g": 0,
"b": 0
},
"fields": [
{
"name": "<#include "messageDeleted_original_message_field_title">",
"value": "${cachedMessage.content}"
},
{
"name": "<#include "messageDeleted_message_link_field_title">",
"value": "[${messageChannel.name}](${cachedMessage.messageUrl})"
}
]
}
@@ -1,26 +0,0 @@
{
"author": {
"name": "${member.effectiveName}#${member.user.discriminator}",
"avatar": "${member.user.effectiveAvatarUrl}"
},
"description": "<#include "messageEdited_description_text">",
"color" : {
"r": 200,
"g": 0,
"b": 0
},
"fields": [
{
"name": "<#include "messageEdited_original_message_field_title">",
"value": "${messageBefore.content}"
},
{
"name": "<#include "messageEdited_new_message_field_title">",
"value": "${messageAfter.contentRaw}"
},
{
"name": "<#include "messageEdited_link_field_title">",
"value": "[${messageChannel.name}](${messageBefore.messageUrl})"
}
]
}
@@ -1,15 +0,0 @@
{
"title": {
"title": "<#include "warnDecay_title">"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"description": "<#list warnings as warning>
<#if warning.warnedMember??><#assign warnedUser>${warning.warnedMember.asMention} (${warning.warnedMember.id})</#assign><#else><#assign warnedUser> ${warning.warning.warnedUser.userReference.id?c}</#assign></#if> <#if warning.warningMember??><#assign warningUser> ${warning.warningMember.asMention} (${warning.warningMember.id})</#assign><#else><#assign warningUser>${warning.warning.warningUser.userReference.id?c}</#assign></#if> <#include "warnDecay_log_warn_entry">
<#else>
<#include "warnDecay_log_no_warnings">
</#list>"
}