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-01 20:44:21 +02:00
parent e8767429bf
commit 9374dfb912
965 changed files with 15775 additions and 2935 deletions

View File

@@ -11,13 +11,34 @@
<artifactId>modmail-impl</artifactId>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/liquibase.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>modmail-int</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -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>

View File

@@ -1,33 +0,0 @@
package dev.sheldan.abstracto.modmail.listener;
import dev.sheldan.abstracto.core.service.management.DefaultConfigManagementService;
import dev.sheldan.abstracto.templating.service.TemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import static dev.sheldan.abstracto.modmail.service.ModMailThreadServiceBean.MODMAIL_CLOSING_MESSAGE_TEXT;
/**
* This listener is executed when the Spring context starts up and is used to set some default values related
* to mod mail.
*/
@Component
public class ModMailDefaultConfigListener {
@Autowired
private DefaultConfigManagementService defaultConfigManagementService;
@Autowired
private TemplateService templateService;
@EventListener
@Transactional
public void handleContextRefreshEvent(ContextRefreshedEvent ctxStartEvt) {
String text = templateService.renderSimpleTemplate("modmail_closing_user_message_description");
defaultConfigManagementService.createDefaultConfig(MODMAIL_CLOSING_MESSAGE_TEXT, text);
}
}

View File

@@ -1,5 +0,0 @@
abstracto.postTargets.modmail=modmailLog,modmailPing
abstracto.emoteNames.readReaction=readReaction
abstracto.defaultEmotes.readReaction=\uD83D\uDC40
abstracto.features.modmail.enabled=false
abstracto.features.modmail.defaultMode=log

View File

@@ -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="modMail-tables/tables.xml" relativeToChangelogFile="true"/>
<include file="modMail-seedData/data.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

View File

@@ -0,0 +1,82 @@
<?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="modmailModule" value="(SELECT id FROM module WHERE name = 'modMail')"/>
<property name="modmailFeature" value="(SELECT id FROM feature WHERE key = 'modmail')"/>
<property name="today" value="(SELECT NOW())"/>
<changeSet author="Sheldan" id="modmail_modMail-commands">
<insert tableName="command">
<column name="name" value="anonReply"/>
<column name="module_id" valueComputed="${modmailModule}"/>
<column name="feature_id" valueComputed="${modmailFeature}"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="command">
<column name="name" value="close"/>
<column name="module_id" valueComputed="${modmailModule}"/>
<column name="feature_id" valueComputed="${modmailFeature}"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="command">
<column name="name" value="closeNoLog"/>
<column name="module_id" valueComputed="${modmailModule}"/>
<column name="feature_id" valueComputed="${modmailFeature}"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="command">
<column name="name" value="closeSilently"/>
<column name="module_id" valueComputed="${modmailModule}"/>
<column name="feature_id" valueComputed="${modmailFeature}"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="command">
<column name="name" value="contact"/>
<column name="module_id" valueComputed="${modmailModule}"/>
<column name="feature_id" valueComputed="${modmailFeature}"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="command">
<column name="name" value="removeModMailRole"/>
<column name="module_id" valueComputed="${modmailModule}"/>
<column name="feature_id" valueComputed="${modmailFeature}"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="command">
<column name="name" value="reply"/>
<column name="module_id" valueComputed="${modmailModule}"/>
<column name="feature_id" valueComputed="${modmailFeature}"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="command">
<column name="name" value="setModMailCategory"/>
<column name="module_id" valueComputed="${modmailModule}"/>
<column name="feature_id" valueComputed="${modmailFeature}"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="command">
<column name="name" value="setModMailRole"/>
<column name="module_id" valueComputed="${modmailModule}"/>
<column name="feature_id" valueComputed="${modmailFeature}"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="command">
<column name="name" value="subscribe"/>
<column name="module_id" valueComputed="${modmailModule}"/>
<column name="feature_id" valueComputed="${modmailFeature}"/>
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="command">
<column name="name" value="unSubscribe"/>
<column name="module_id" valueComputed="${modmailModule}"/>
<column name="feature_id" valueComputed="${modmailFeature}"/>
<column name="created" valueComputed="${today}"/>
</insert>
</changeSet>
</databaseChangeLog>

View File

@@ -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" >
<include file="default_config.xml" relativeToChangelogFile="true"/>
<include file="module.xml" relativeToChangelogFile="true"/>
<include file="feature.xml" relativeToChangelogFile="true"/>
<include file="default_feature_flag.xml" relativeToChangelogFile="true"/>
<include file="default_posttarget.xml" relativeToChangelogFile="true"/>
<include file="command.xml" relativeToChangelogFile="true"/>
<include file="default_emote.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

View File

@@ -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">
<property name="today" value="(SELECT NOW())"/>
<changeSet author="Sheldan" id="modMailClosingText-insert">
<insert tableName="default_config">
<column name="name" value="modMailClosingText"/>
<column name="string_value" value="Thread has been closed."/>
<column name="created" valueComputed="${today}"/>
</insert>
</changeSet>
</databaseChangeLog>

View File

@@ -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" >
<property name="today" value="(SELECT NOW())"/>
<changeSet author="Sheldan" id="modmail_default_emote-insert">
<insert tableName="default_emote">
<column name="emote_key" value="readReaction"/>
<column name="name" value="👀"/>
<column name="created" valueComputed="${today}"/>
</insert>
</changeSet>
</databaseChangeLog>

View File

@@ -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="modmailFeature" value="(SELECT id FROM feature WHERE key = 'modmail')"/>
<property name="today" value="(SELECT NOW())"/>
<changeSet author="Sheldan" id="modmaildefau_default_feature_flag-insertion">
<insert tableName="default_feature_flag">
<column name="enabled" value="false"/>
<column name="feature_id" valueComputed="${modmailFeature}" />
<column name="mode" value="log"/>
<column name="created" valueComputed="${today}"/>
</insert>
</changeSet>
</databaseChangeLog>

View File

@@ -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" >
<changeSet author="Sheldan" id="modmail_default_posttarget-insertion">
<insert tableName="default_posttarget">
<column name="name" value="modmailLog"/>
</insert>
<insert tableName="default_posttarget">
<column name="name" value="modmailPing"/>
</insert>
</changeSet>
</databaseChangeLog>

View File

@@ -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="modmail_feature-insertion">
<insert tableName="feature">
<column name="key" value="modmail"/>
<column name="created" valueComputed="${today}"/>
</insert>
</changeSet>
</databaseChangeLog>

View File

@@ -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="modMail-module-insertion">
<insert tableName="module">
<column name="name" value="modMail"/>
<column name="created" valueComputed="${today}"/>
</insert>
</changeSet>
</databaseChangeLog>

View File

@@ -0,0 +1,31 @@
<?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="modmail_messages-table">
<createTable tableName="modmail_messages">
<column name="message_id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="modmail_messages_pkey"/>
</column>
<column name="anonymous" type="BOOLEAN"/>
<column name="created" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="dm_channel" type="BOOLEAN"/>
<column name="modmail_message_author" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="thread_reference" type="BIGINT">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="Sheldan" id="modmail_messages-fk_modmail_message_thread">
<addForeignKeyConstraint baseColumnNames="thread_reference" baseTableName="modmail_messages" constraintName="fk_modmail_message_thread" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableName="modmail_thread" validate="true"/>
</changeSet>
<changeSet author="Sheldan" id="modmail_messages-fk_modmail_message_author">
<addForeignKeyConstraint baseColumnNames="modmail_message_author" baseTableName="modmail_messages" constraintName="fk_modmail_message_author" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="user_in_server_id" referencedTableName="user_in_server" validate="true"/>
</changeSet>
</databaseChangeLog>

View File

@@ -0,0 +1,30 @@
<?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="modmail_roles-table">
<createTable tableName="modmail_roles">
<column autoIncrement="true" name="mod_mail_role_id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="modmail_roles_pkey"/>
</column>
<column name="created" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="updated" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="modmail_role" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="modmail_role_server" type="BIGINT">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="Sheldan" id="modmail_roles-fk_modmail_role_role">
<addForeignKeyConstraint baseColumnNames="modmail_role" baseTableName="modmail_roles" constraintName="fk_modmail_role_role" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableName="role" validate="true"/>
</changeSet>
<changeSet author="Sheldan" id="modmail_roles-fk_modmail_role_server">
<addForeignKeyConstraint baseColumnNames="modmail_role_server" baseTableName="modmail_roles" constraintName="fk_modmail_role_server" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableName="server" validate="true"/>
</changeSet>
</databaseChangeLog>

View File

@@ -0,0 +1,31 @@
<?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="modmail_subscriber-table">
<createTable tableName="modmail_subscriber">
<column autoIncrement="true" name="subscriber_id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="modmail_subscriber_pkey"/>
</column>
<column name="created" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="modmail_thread_subscriber" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="mod_mail_thread" type="BIGINT">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="Sheldan" id="modmail_subscriber-fk_modmail_thread_subscriber_user">
<addForeignKeyConstraint baseColumnNames="modmail_thread_subscriber" baseTableName="modmail_subscriber" constraintName="fk_modmail_thread_subscriber_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="modmail_subscriber-fk_modmail_thread_thread">
<addForeignKeyConstraint baseColumnNames="mod_mail_thread" baseTableName="modmail_subscriber" constraintName="fk_modmail_thread_thread" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableName="modmail_thread" validate="true"/>
</changeSet>
</databaseChangeLog>

View File

@@ -0,0 +1,38 @@
<?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="modmail_thread-table">
<createTable tableName="modmail_thread">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="modmail_thread_pkey"/>
</column>
<column name="closed" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="created" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="state" type="VARCHAR(255)"/>
<column name="updated" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="modmail_thread_channel" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="modmail_thread_server" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="modmail_user" type="BIGINT">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="Sheldan" id="modmail_thread-fk_modmail_thread_channel">
<addForeignKeyConstraint baseColumnNames="modmail_thread_channel" baseTableName="modmail_thread" constraintName="fk_modmail_thread_channel" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableName="channel" validate="true"/>
</changeSet>
<changeSet author="Sheldan" id="modmail_thread-fk_modmail_thread_user">
<addForeignKeyConstraint baseColumnNames="modmail_user" baseTableName="modmail_thread" constraintName="fk_modmail_thread_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="modmail_thread-fk_modmail_thread_server">
<addForeignKeyConstraint baseColumnNames="modmail_thread_server" baseTableName="modmail_thread" constraintName="fk_modmail_thread_server" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableName="server" validate="true"/>
</changeSet>
</databaseChangeLog>

View File

@@ -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="modmail_threads.xml" relativeToChangelogFile="true"/>
<include file="modmail_messages.xml" relativeToChangelogFile="true"/>
<include file="modmail_subscriber.xml" relativeToChangelogFile="true"/>
<include file="modmail_roles.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

View File

@@ -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-modmail/collection.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

View File

@@ -1,18 +0,0 @@
{
"author": {
"name": "${member.effectiveName}",
"avatar": "${member.user.effectiveAvatarUrl}"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"description": "<#include "modmail_thread_already_exists">",
"fields": [
{
"name": "<#include "modmail_existing_thread_link_field_title">",
"value": "[<#include "modmail_existing_thread_link_content_display_text">](${threadUrl})"
}
]
}

View File

@@ -1 +0,0 @@
<#assign categoryId>${(error.templateModel['categoryId'])!"0"}</#assign><#include "modmail_category_not_setup_text">

View File

@@ -1,12 +0,0 @@
{
"author": {
"name": "${user.member.effectiveName}",
"avatar": "${user.member.user.effectiveAvatarUrl}"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"description": "<#include "close_failed_to_delete_text_channel">"
}

View File

@@ -1,12 +0,0 @@
{
"author": {
"name": "${user.member.effectiveName}",
"avatar": "${user.member.user.effectiveAvatarUrl}"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"description": "<#include "reply_exception_cannot_send_message_to_use">"
}

View File

@@ -1,12 +0,0 @@
{
"author": {
"name": "${user.member.effectiveName}",
"avatar": "${user.member.user.effectiveAvatarUrl}"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"description": "<#include "modmail_failed_to_create_mod_mail_thread">"
}

View File

@@ -1,12 +0,0 @@
{
"author": {
"name": "${user.member.effectiveName}",
"avatar": "${user.member.user.effectiveAvatarUrl}"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"description": "<#include "modmail_generic_error">"
}

View File

@@ -1,12 +0,0 @@
{
"author": {
"name": "${user.member.effectiveName}",
"avatar": "${user.member.user.effectiveAvatarUrl}"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"description": "<#include "modmail_post_target_error">"
}

View File

@@ -1,5 +0,0 @@
<#include "server_chooser_server_list_description">
<#list commonGuilds as guild>
${guild.reactionEmote} ${guild.guild.guild.name}
</#list>

View File

@@ -1,8 +0,0 @@
{
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"description": "<#include "modmail_no_server_available">"
}

View File

@@ -1,19 +0,0 @@
{
"author": {
"name": "${threadUser.member.effectiveName}",
"avatar": "${threadUser.member.user.effectiveAvatarUrl}"
},
"title": {
"title": "<#include "modmail_notification_message_title">"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
<#assign user>${threadUser.member.effectiveName}#${threadUser.member.user.discriminator}(${threadUser.member.user.id})</#assign>
"description": "<#include "modmail_notification_message_description">"
<#if roles?size gt 0>
,"additionalMessage": "<#list roles as role>${role.role.asMention}<#sep>,</#list>"
</#if>
}

View File

@@ -1,23 +0,0 @@
{
"author": {
"name": "${threadUser.member.effectiveName}",
"avatar": "${threadUser.member.user.effectiveAvatarUrl}"
},
"title": {
"title": "<#include "modmail_thread_user_message_title">"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
<#if postedMessage.contentRaw?has_content>
"description": "${postedMessage.contentRaw}"
</#if>
<#if postedMessage.attachments?size gt 0>
,"imageUrl": "${postedMessage.attachments[0].proxyUrl}"
</#if>
<#if subscribers?size gt 0>
,"additionalMessage": "<#list subscribers as subscriber>${subscriber.member.asMention}<#sep>,</#list>"
</#if>
}

View File

@@ -1,15 +0,0 @@
{
"title": {
"title": "<#include "modmail_closing_notification_title">"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
<#assign messageCount>${closedThread.messages?size}</#assign>
<#assign user>user</#assign>
<#assign startDate>${formatDate(closedThread.created,"yyyy-MM-dd HH:mm:ss")}</#assign>
<#assign duration>${fmtDuration(duration)}</#assign>
"description": "<#include "close_closing_description">"
}

View File

@@ -1,21 +0,0 @@
{
"author": {
"name": "${author.member.effectiveName}",
"avatar": "${author.member.user.effectiveAvatarUrl}"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
}
<#if message.embeds[0].description?has_content>
,"description": "${message.embeds[0].description}"
</#if>
<#if message.attachments?size gt 0>
,"imageUrl": "${message.embeds[0].image.proxyUrl}"
</#if>
<#if modMailMessage.anonymous>
, "additionalMessage": "<#include "modmail_anonymous_message_note">"
</#if>
,"timeStamp": "${message.timeCreated}"
}

View File

@@ -1,8 +0,0 @@
{
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"description": "${closingMessage}"
}

View File

@@ -1,20 +0,0 @@
{
"author": {
"name": "${moderator.effectiveName}",
"avatar": "${moderator.user.effectiveAvatarUrl}"
},
"title": {
"title": "<#include "modmail_thread_staff_message_title">"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
}
<#if text?has_content>
, "description": "${text}"
</#if>
<#if postedMessage.attachments?size gt 0>
,"imageUrl": "${postedMessage.attachments[0].proxyUrl}"
</#if>
}

View File

@@ -1,15 +0,0 @@
{
"author": {
"name": "${threadUser.member.effectiveName}",
"avatar": "${threadUser.member.user.effectiveAvatarUrl}"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
<#assign user>${threadUser.member.effectiveName}#${threadUser.member.user.discriminator} (${threadUser.member.user.id})</#assign>
<#assign joinDate>${threadUser.member.timeJoined}</#assign>
<#assign roles><#list threadUser.member.roles as role>${role.asMention}<#sep>,<#else><#include "modmail_thread_header_no_roles"></#list></#assign>
"description": "<#include "modmail_thread_header_embed_description">"
}

View File

@@ -1 +0,0 @@
<#assign category>${param.category.name}</#assign><#include "setup_modmail_category_action_display">

View File

@@ -1 +0,0 @@
<#assign categoryName><#if category?has_content>${category.name}<#else><#include "setup_modmail_category_message_no_category"></#if></#assign><#include "setup_modmail_category_message_display">