Compare commits
5 Commits
1.2.2
...
979e0a0e6f
Author | SHA1 | Date | |
---|---|---|---|
979e0a0e6f | |||
fdf10f2728 | |||
f7ffd78dcc | |||
8ddb9f087a | |||
0ca3be478b |
@@ -1,17 +0,0 @@
|
|||||||
#### Beschreibung
|
|
||||||
|
|
||||||
Als Produktmanager muss ich nun dieses Ticket ausfüllen.
|
|
||||||
|
|
||||||
#### Aktuelles Verhalten
|
|
||||||
|
|
||||||
* Was macht die Software aktuell?
|
|
||||||
|
|
||||||
#### Gewünschtes Verhalten
|
|
||||||
|
|
||||||
* Was soll die Software anders machen?
|
|
||||||
|
|
||||||
#### Akzeptanzkriterien
|
|
||||||
|
|
||||||
* Was muss erfüllt sein, damit das Ticket als abgeschlossen angesehen werden kann?
|
|
||||||
|
|
||||||
#### Anmerkungen
|
|
@@ -1,7 +0,0 @@
|
|||||||
#### Ticket Referenz:
|
|
||||||
|
|
||||||
#1
|
|
||||||
|
|
||||||
#### Gibt es etwas beim Review zu beachten?
|
|
||||||
|
|
||||||
Nein
|
|
@@ -1,71 +0,0 @@
|
|||||||
name: Deploy dev on push
|
|
||||||
run-name: Deploy dev on push
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- dev
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
on-push-deploy_sh-edraft:
|
|
||||||
runs-on: [ dobby.sh-edraft.de, ubuntu-latest ]
|
|
||||||
container: sh-edraft.de/act-runner:latest
|
|
||||||
steps:
|
|
||||||
- name: Setup docker
|
|
||||||
uses: https://github.com/papodaca/install-docker-action@main
|
|
||||||
- run: docker -v
|
|
||||||
|
|
||||||
- name: Clone Repository
|
|
||||||
uses: https://github.com/actions/checkout@v3
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.CI_ACCESS_TOKEN }}
|
|
||||||
submodules: true
|
|
||||||
|
|
||||||
- name: Prepare bot build
|
|
||||||
run: |
|
|
||||||
cd bot
|
|
||||||
python3.10 -m pip install --extra-index-url https://pip.sh-edraft.de cpl-cli
|
|
||||||
cpl i
|
|
||||||
|
|
||||||
- name: Setup node
|
|
||||||
uses: https://github.com/actions/setup-node@v3
|
|
||||||
|
|
||||||
- name: Prepare web build
|
|
||||||
run: |
|
|
||||||
cd web
|
|
||||||
npm install -g ts-node
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
- name: Shutdown stack
|
|
||||||
run: docker stack rm sdb_dev
|
|
||||||
|
|
||||||
- name: Build docker bot
|
|
||||||
run: |
|
|
||||||
cd bot
|
|
||||||
docker image prune -f
|
|
||||||
cpl build
|
|
||||||
docker build -t sh-edraft.de/sdb-bot:$(cpl gv)-dev .
|
|
||||||
|
|
||||||
- name: Build docker web
|
|
||||||
run: |
|
|
||||||
cd web
|
|
||||||
docker image prune -f
|
|
||||||
cp src/favicon.dev.ico src/favicon.ico
|
|
||||||
npm run build
|
|
||||||
docker build -t sh-edraft.de/sdb-web:$(npm run -s gv)-dev .
|
|
||||||
|
|
||||||
- name: Set version
|
|
||||||
run: |
|
|
||||||
cd bot/docker
|
|
||||||
chmod +x ./set-docker-compose-image-version.sh
|
|
||||||
./set-docker-compose-image-version.sh sh-edraft.de/sdb-bot:$(cd ../; cpl gv)-dev sh-edraft.de/sdb-web:$(cd ../../web; npm run -s gv;)-dev
|
|
||||||
|
|
||||||
- name: Deploy Stack to sh-edraft.de
|
|
||||||
uses: https://github.com/kgierke/portainer-stack-deployment@v1
|
|
||||||
with:
|
|
||||||
portainer-url: "https://docker.sh-edraft.de"
|
|
||||||
portainer-username: "gitea_job"
|
|
||||||
portainer-password: "${{ secrets.docker_job }}"
|
|
||||||
portainer-endpoint: 2
|
|
||||||
name: sdb_dev
|
|
||||||
file: bot/docker/docker-compose.dev.yml
|
|
||||||
variables: '{}'
|
|
@@ -1,70 +0,0 @@
|
|||||||
name: Deploy prod on push
|
|
||||||
run-name: Deploy prod on push
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
on-push-deploy_sh-edraft:
|
|
||||||
runs-on: [ dobby.sh-edraft.de, ubuntu-latest ]
|
|
||||||
container: sh-edraft.de/act-runner:latest
|
|
||||||
steps:
|
|
||||||
- name: Setup docker
|
|
||||||
uses: https://github.com/papodaca/install-docker-action@main
|
|
||||||
- run: docker -v
|
|
||||||
|
|
||||||
- name: Clone Repository
|
|
||||||
uses: https://github.com/actions/checkout@v3
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.CI_ACCESS_TOKEN }}
|
|
||||||
submodules: true
|
|
||||||
|
|
||||||
- name: Prepare bot build
|
|
||||||
run: |
|
|
||||||
cd bot
|
|
||||||
python3.10 -m pip install --extra-index-url https://pip.sh-edraft.de cpl-cli
|
|
||||||
cpl i
|
|
||||||
|
|
||||||
- name: Setup node
|
|
||||||
uses: https://github.com/actions/setup-node@v3
|
|
||||||
|
|
||||||
- name: Prepare web build
|
|
||||||
run: |
|
|
||||||
cd web
|
|
||||||
npm install -g ts-node
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
- name: Shutdown stack
|
|
||||||
run: docker stack rm sdb_prod
|
|
||||||
|
|
||||||
- name: Build docker bot
|
|
||||||
run: |
|
|
||||||
cd bot
|
|
||||||
docker image prune -f
|
|
||||||
cpl build
|
|
||||||
docker build -t sh-edraft.de/sdb-bot:$(cpl gv) .
|
|
||||||
|
|
||||||
- name: Build docker web
|
|
||||||
run: |
|
|
||||||
cd web
|
|
||||||
docker image prune -f
|
|
||||||
npm run build
|
|
||||||
docker build -t sh-edraft.de/sdb-web:$(npm run -s gv) .
|
|
||||||
|
|
||||||
- name: Set version
|
|
||||||
run: |
|
|
||||||
cd bot/docker
|
|
||||||
chmod +x ./set-docker-compose-image-version.sh
|
|
||||||
./set-docker-compose-image-version.sh sh-edraft.de/sdb-bot:$(cd ../; cpl gv) sh-edraft.de/sdb-web:$(cd ../../web; npm run -s gv;)
|
|
||||||
|
|
||||||
- name: Deploy Stack to sh-edraft.de
|
|
||||||
uses: https://github.com/kgierke/portainer-stack-deployment@v1
|
|
||||||
with:
|
|
||||||
portainer-url: "https://docker.sh-edraft.de"
|
|
||||||
portainer-username: "gitea_job"
|
|
||||||
portainer-password: "${{ secrets.docker_job }}"
|
|
||||||
portainer-endpoint: 2
|
|
||||||
name: sdb_prod
|
|
||||||
file: bot/docker/docker-compose.yml
|
|
||||||
variables: '{}'
|
|
@@ -1,71 +0,0 @@
|
|||||||
name: Deploy staging on push
|
|
||||||
run-name: Deploy staging on push
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- staging
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
on-push-deploy_sh-edraft:
|
|
||||||
runs-on: [ dobby.sh-edraft.de, ubuntu-latest ]
|
|
||||||
container: sh-edraft.de/act-runner:latest
|
|
||||||
steps:
|
|
||||||
- name: Setup docker
|
|
||||||
uses: https://github.com/papodaca/install-docker-action@main
|
|
||||||
- run: docker -v
|
|
||||||
|
|
||||||
- name: Clone Repository
|
|
||||||
uses: https://github.com/actions/checkout@v3
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.CI_ACCESS_TOKEN }}
|
|
||||||
submodules: true
|
|
||||||
|
|
||||||
- name: Prepare bot build
|
|
||||||
run: |
|
|
||||||
cd bot
|
|
||||||
python3.10 -m pip install --extra-index-url https://pip.sh-edraft.de cpl-cli
|
|
||||||
cpl i
|
|
||||||
|
|
||||||
- name: Setup node
|
|
||||||
uses: https://github.com/actions/setup-node@v3
|
|
||||||
|
|
||||||
- name: Prepare web build
|
|
||||||
run: |
|
|
||||||
cd web
|
|
||||||
npm install -g ts-node
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
- name: Shutdown stack
|
|
||||||
run: docker stack rm sdb_staging
|
|
||||||
|
|
||||||
- name: Build docker bot
|
|
||||||
run: |
|
|
||||||
cd bot
|
|
||||||
docker image prune -f
|
|
||||||
cpl build
|
|
||||||
docker build -t sh-edraft.de/sdb-bot:$(cpl gv)-staging .
|
|
||||||
|
|
||||||
- name: Build docker web
|
|
||||||
run: |
|
|
||||||
cd web
|
|
||||||
docker image prune -f
|
|
||||||
cp src/favicon.staging.ico src/favicon.ico
|
|
||||||
npm run build
|
|
||||||
docker build -t sh-edraft.de/sdb-web:$(npm run -s gv)-staging .
|
|
||||||
|
|
||||||
- name: Set version
|
|
||||||
run: |
|
|
||||||
cd bot/docker
|
|
||||||
chmod +x ./set-docker-compose-image-version.sh
|
|
||||||
./set-docker-compose-image-version.sh sh-edraft.de/sdb-bot:$(cd ../; cpl gv)-staging sh-edraft.de/sdb-web:$(cd ../../web; npm run -s gv;)-staging
|
|
||||||
|
|
||||||
- name: Deploy Stack to sh-edraft.de
|
|
||||||
uses: https://github.com/kgierke/portainer-stack-deployment@v1
|
|
||||||
with:
|
|
||||||
portainer-url: "https://docker.sh-edraft.de"
|
|
||||||
portainer-username: "gitea_job"
|
|
||||||
portainer-password: "${{ secrets.docker_job }}"
|
|
||||||
portainer-endpoint: 2
|
|
||||||
name: sdb_staging
|
|
||||||
file: bot/docker/docker-compose.staging.yml
|
|
||||||
variables: '{}'
|
|
18
.gitmodules
vendored
18
.gitmodules
vendored
@@ -1,9 +1,9 @@
|
|||||||
[submodule "bot/src/bot/config"]
|
[submodule "kdb-bot/src/bot/config"]
|
||||||
path = bot/src/bot/config
|
path = kdb-bot/src/bot/config
|
||||||
url = https://git.sh-edraft.de/sh-edraft.de/sh_discord_bot.config.git
|
url = https://git.sh-edraft.de/sh-edraft.de/kd_discord_bot.config.git
|
||||||
[submodule "bot/src/bot_api/config"]
|
[submodule "kdb-bot/src/bot_api/config"]
|
||||||
path = bot/src/bot_api/config
|
path = kdb-bot/src/bot_api/config
|
||||||
url = https://git.sh-edraft.de/sh-edraft.de/sh_discord_bot.api.config.git
|
url = https://git.sh-edraft.de/sh-edraft.de/kd_discord_bot.api.config.git
|
||||||
[submodule "bot/docker"]
|
[submodule "kdb-bot/docker"]
|
||||||
path = bot/docker
|
path = kdb-bot/docker
|
||||||
url = https://git.sh-edraft.de/sh-edraft.de/sh_discord_bot.docker.git
|
url = https://git.sh-edraft.de/sh-edraft.de/kd_discord_bot.docker.git
|
||||||
|
@@ -1,100 +0,0 @@
|
|||||||
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
|
||||||
|
|
||||||
|
|
||||||
class DBTable(GenerateSchematicABC):
|
|
||||||
def __init__(self, *args: str):
|
|
||||||
GenerateSchematicABC.__init__(self, *args)
|
|
||||||
self._name = self._name.replace("_db_table", "")
|
|
||||||
self._class_name = self._class_name.split("Db_table")[0]
|
|
||||||
|
|
||||||
def get_code(self) -> str:
|
|
||||||
import textwrap
|
|
||||||
|
|
||||||
code = textwrap.dedent(
|
|
||||||
"""\
|
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from cpl_core.database import TableABC
|
|
||||||
|
|
||||||
|
|
||||||
class $ClassName(TableABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
value: str,
|
|
||||||
created_at: datetime = None,
|
|
||||||
modified_at: datetime = None,
|
|
||||||
id=0,
|
|
||||||
):
|
|
||||||
self._id = id
|
|
||||||
self._value = value
|
|
||||||
|
|
||||||
TableABC.__init__(self)
|
|
||||||
self._created_at = created_at if created_at is not None else self._created_at
|
|
||||||
self._modified_at = modified_at if modified_at is not None else self._modified_at
|
|
||||||
|
|
||||||
@property
|
|
||||||
def value(self) -> str:
|
|
||||||
return self._value
|
|
||||||
|
|
||||||
@value.setter
|
|
||||||
def value(self, value: str):
|
|
||||||
self._value = value
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_all_string() -> str:
|
|
||||||
return str(
|
|
||||||
f\"""
|
|
||||||
SELECT * FROM `$TableName`;
|
|
||||||
\"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_id_string(id: int) -> str:
|
|
||||||
return str(
|
|
||||||
f\"""
|
|
||||||
SELECT * FROM `$TableName`
|
|
||||||
WHERE `Id` = {id};
|
|
||||||
\"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def insert_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f\"""
|
|
||||||
INSERT INTO `$TableName` (
|
|
||||||
`Value`
|
|
||||||
) VALUES (
|
|
||||||
{self._value}
|
|
||||||
);
|
|
||||||
\"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def udpate_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f\"""
|
|
||||||
UPDATE `$TableName`
|
|
||||||
SET `Value` = {self._value}
|
|
||||||
WHERE `Id` = {self._id};
|
|
||||||
\"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def delete_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f\"""
|
|
||||||
DELETE FROM `$TableName`
|
|
||||||
WHERE `Id` = {self._id};
|
|
||||||
\"""
|
|
||||||
)
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
return self.build_code_str(
|
|
||||||
code,
|
|
||||||
ClassName=self._class_name,
|
|
||||||
TableName=self._class_name,
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def register(cls):
|
|
||||||
GenerateSchematicABC.register(cls, "db-table", [])
|
|
@@ -1,55 +0,0 @@
|
|||||||
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(GenerateSchematicABC):
|
|
||||||
def __init__(self, *args: str):
|
|
||||||
GenerateSchematicABC.__init__(self, *args)
|
|
||||||
|
|
||||||
def get_code(self) -> str:
|
|
||||||
import textwrap
|
|
||||||
|
|
||||||
code = textwrap.dedent(
|
|
||||||
"""\
|
|
||||||
from bot_core.logging.database_logger import DatabaseLogger
|
|
||||||
from bot_data.abc.migration_abc import MigrationABC
|
|
||||||
from bot_data.db_context import DBContext
|
|
||||||
|
|
||||||
|
|
||||||
class $ClassName(MigrationABC):
|
|
||||||
name = "1.0_$ClassName"
|
|
||||||
|
|
||||||
def __init__(self, logger: DatabaseLogger, db: DBContext):
|
|
||||||
MigrationABC.__init__(self)
|
|
||||||
self._logger = logger
|
|
||||||
self._db = db
|
|
||||||
self._cursor = db.cursor
|
|
||||||
|
|
||||||
def upgrade(self):
|
|
||||||
self._logger.debug(__name__, "Running upgrade")
|
|
||||||
|
|
||||||
self._cursor.execute(
|
|
||||||
str(
|
|
||||||
f\"""
|
|
||||||
CREATE TABLE IF NOT EXISTS `$TableName` (
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`CreatedAt` DATETIME(6),
|
|
||||||
`LastModifiedAt` DATETIME(6),
|
|
||||||
PRIMARY KEY(`Id`)
|
|
||||||
);
|
|
||||||
\"""
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
def downgrade(self):
|
|
||||||
self._cursor.execute("DROP TABLE `$TableName`;")
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
return self.build_code_str(
|
|
||||||
code,
|
|
||||||
ClassName=self._class_name,
|
|
||||||
TableName=self._class_name.split("Migration")[0],
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def register(cls):
|
|
||||||
GenerateSchematicABC.register(cls, "migration", [])
|
|
Submodule bot/docker deleted from b0bacce9f6
Submodule bot/src/bot/config deleted from c11ca6f2e8
@@ -1,22 +0,0 @@
|
|||||||
import os
|
|
||||||
import shutil
|
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from cpl_core.application.application_extension_abc import ApplicationExtensionABC
|
|
||||||
from cpl_core.configuration import ConfigurationABC
|
|
||||||
from cpl_core.dependency_injection import ServiceProviderABC
|
|
||||||
from cpl_query.extension import List
|
|
||||||
|
|
||||||
|
|
||||||
class CleanLogsExtension(ApplicationExtensionABC):
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
async def run(self, config: ConfigurationABC, services: ServiceProviderABC):
|
|
||||||
(
|
|
||||||
List(str, os.listdir("logs/"))
|
|
||||||
.where(lambda x: os.path.isdir(f"logs/{x}"))
|
|
||||||
.order_by()
|
|
||||||
.where(lambda x: (datetime.now() - datetime.strptime(x, "%Y-%m-%d")).days >= 7)
|
|
||||||
.for_each(lambda x: shutil.rmtree(f"logs/{x}"))
|
|
||||||
)
|
|
Submodule bot/src/bot_api/config deleted from 521951b8ab
@@ -1,22 +0,0 @@
|
|||||||
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
|
|
||||||
|
|
||||||
|
|
||||||
class ApiSettings(ConfigurationModelABC):
|
|
||||||
def __init__(self, port: int = None, host: str = None, redirect_uri: bool = None):
|
|
||||||
ConfigurationModelABC.__init__(self)
|
|
||||||
|
|
||||||
self._port = 80 if port is None else port
|
|
||||||
self._host = "" if host is None else host
|
|
||||||
self._redirect_to_https = False if redirect_uri is None else redirect_uri
|
|
||||||
|
|
||||||
@property
|
|
||||||
def port(self) -> int:
|
|
||||||
return self._port
|
|
||||||
|
|
||||||
@property
|
|
||||||
def host(self) -> str:
|
|
||||||
return self._host
|
|
||||||
|
|
||||||
@property
|
|
||||||
def redirect_to_https(self) -> bool:
|
|
||||||
return self._redirect_to_https
|
|
@@ -1,39 +0,0 @@
|
|||||||
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
|
|
||||||
|
|
||||||
|
|
||||||
class AuthenticationSettings(ConfigurationModelABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
secret_key: str = None,
|
|
||||||
issuer: str = None,
|
|
||||||
audience: str = None,
|
|
||||||
token_expire_time: int = None,
|
|
||||||
refresh_token_expire_time: int = None,
|
|
||||||
):
|
|
||||||
ConfigurationModelABC.__init__(self)
|
|
||||||
|
|
||||||
self._secret_key = "" if secret_key is None else secret_key
|
|
||||||
self._issuer = "" if issuer is None else issuer
|
|
||||||
self._audience = "" if audience is None else audience
|
|
||||||
self._token_expire_time = 0 if token_expire_time is None else token_expire_time
|
|
||||||
self._refresh_token_expire_time = 0 if refresh_token_expire_time is None else refresh_token_expire_time
|
|
||||||
|
|
||||||
@property
|
|
||||||
def secret_key(self) -> str:
|
|
||||||
return self._secret_key
|
|
||||||
|
|
||||||
@property
|
|
||||||
def issuer(self) -> str:
|
|
||||||
return self._issuer
|
|
||||||
|
|
||||||
@property
|
|
||||||
def audience(self) -> str:
|
|
||||||
return self._audience
|
|
||||||
|
|
||||||
@property
|
|
||||||
def token_expire_time(self) -> int:
|
|
||||||
return self._token_expire_time
|
|
||||||
|
|
||||||
@property
|
|
||||||
def refresh_token_expire_time(self) -> int:
|
|
||||||
return self._refresh_token_expire_time
|
|
@@ -1,40 +0,0 @@
|
|||||||
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
|
|
||||||
from cpl_query.extension import List
|
|
||||||
|
|
||||||
|
|
||||||
class DiscordAuthenticationSettings(ConfigurationModelABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
client_secret: str = None,
|
|
||||||
redirect_uri: str = None,
|
|
||||||
scope: list = None,
|
|
||||||
token_url: str = None,
|
|
||||||
auth_url: str = None,
|
|
||||||
):
|
|
||||||
ConfigurationModelABC.__init__(self)
|
|
||||||
|
|
||||||
self._client_secret = "" if client_secret is None else client_secret
|
|
||||||
self._redirect_url = "" if redirect_uri is None else redirect_uri
|
|
||||||
self._scope = List() if scope is None else List(str, scope)
|
|
||||||
self._token_url = "" if token_url is None else token_url
|
|
||||||
self._auth_url = "" if auth_url is None else auth_url
|
|
||||||
|
|
||||||
@property
|
|
||||||
def client_secret(self) -> str:
|
|
||||||
return self._client_secret
|
|
||||||
|
|
||||||
@property
|
|
||||||
def redirect_url(self) -> str:
|
|
||||||
return self._redirect_url
|
|
||||||
|
|
||||||
@property
|
|
||||||
def scope(self) -> List[str]:
|
|
||||||
return self._scope
|
|
||||||
|
|
||||||
@property
|
|
||||||
def token_url(self) -> str:
|
|
||||||
return self._token_url
|
|
||||||
|
|
||||||
@property
|
|
||||||
def auth_url(self) -> str:
|
|
||||||
return self._auth_url
|
|
@@ -1,12 +0,0 @@
|
|||||||
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
|
|
||||||
|
|
||||||
|
|
||||||
class FrontendSettings(ConfigurationModelABC):
|
|
||||||
def __init__(self, url: str = None):
|
|
||||||
ConfigurationModelABC.__init__(self)
|
|
||||||
|
|
||||||
self._url = "" if url is None else url
|
|
||||||
|
|
||||||
@property
|
|
||||||
def url(self) -> str:
|
|
||||||
return self._url
|
|
@@ -1,33 +0,0 @@
|
|||||||
import asyncio
|
|
||||||
from abc import abstractmethod
|
|
||||||
|
|
||||||
from cpl_core.configuration import ConfigurationABC
|
|
||||||
from cpl_core.dependency_injection import ServiceProviderABC
|
|
||||||
from cpl_discord.service import DiscordBotServiceABC
|
|
||||||
from discord.ext import commands
|
|
||||||
|
|
||||||
from bot_core.environment_variables import MAINTENANCE
|
|
||||||
from bot_core.logging.task_logger import TaskLogger
|
|
||||||
|
|
||||||
|
|
||||||
class TaskABC(commands.Cog):
|
|
||||||
@abstractmethod
|
|
||||||
def __init__(self):
|
|
||||||
commands.Cog.__init__(self)
|
|
||||||
|
|
||||||
@ServiceProviderABC.inject
|
|
||||||
def _is_maintenance(self, config: ConfigurationABC) -> bool:
|
|
||||||
return config.get_configuration(MAINTENANCE) is True
|
|
||||||
|
|
||||||
@ServiceProviderABC.inject
|
|
||||||
async def _wait_until_ready(self, config: ConfigurationABC, logger: TaskLogger, bot: DiscordBotServiceABC):
|
|
||||||
logger.debug(__name__, f"Waiting before ready {type(self).__name__}")
|
|
||||||
await bot.wait_until_ready()
|
|
||||||
|
|
||||||
async def wait():
|
|
||||||
is_ready = config.get_configuration("IS_READY") is True
|
|
||||||
if not is_ready:
|
|
||||||
await asyncio.sleep(1)
|
|
||||||
await wait()
|
|
||||||
|
|
||||||
await wait()
|
|
@@ -1,66 +0,0 @@
|
|||||||
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
|
|
||||||
|
|
||||||
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
|
||||||
|
|
||||||
|
|
||||||
class FeatureFlagsSettings(ConfigurationModelABC):
|
|
||||||
_flags = {
|
|
||||||
# modules
|
|
||||||
FeatureFlagsEnum.achievements_module.value: False, # 14.06.2023 #268
|
|
||||||
FeatureFlagsEnum.api_module.value: False, # 13.10.2022 #70
|
|
||||||
FeatureFlagsEnum.auto_role_module.value: False, # 03.10.2022 #54
|
|
||||||
FeatureFlagsEnum.base_module.value: True, # 02.10.2022 #48
|
|
||||||
FeatureFlagsEnum.boot_log_module.value: True, # 02.10.2022 #48
|
|
||||||
FeatureFlagsEnum.core_module.value: True, # 03.10.2022 #56
|
|
||||||
FeatureFlagsEnum.core_extension_module.value: True, # 03.10.2022 #56
|
|
||||||
FeatureFlagsEnum.data_module.value: True, # 03.10.2022 #56
|
|
||||||
FeatureFlagsEnum.database_module.value: True, # 02.10.2022 #48
|
|
||||||
FeatureFlagsEnum.moderator_module.value: False, # 02.10.2022 #48
|
|
||||||
FeatureFlagsEnum.permission_module.value: True, # 02.10.2022 #48
|
|
||||||
FeatureFlagsEnum.config_module.value: True, # 19.07.2023 #127
|
|
||||||
FeatureFlagsEnum.short_role_name_module.value: True, # 28.09.2023 #378
|
|
||||||
FeatureFlagsEnum.steam_special_offers_module.value: True, # 11.10.2023 #188
|
|
||||||
# features
|
|
||||||
FeatureFlagsEnum.api_only.value: False, # 13.10.2022 #70
|
|
||||||
FeatureFlagsEnum.presence.value: True, # 03.10.2022 #56
|
|
||||||
FeatureFlagsEnum.version_in_presence.value: False, # 21.03.2023 #253
|
|
||||||
FeatureFlagsEnum.game_server.value: False, # 25.09.2023 #366
|
|
||||||
FeatureFlagsEnum.sync_xp.value: False, # 25.09.2023 #366
|
|
||||||
FeatureFlagsEnum.short_role_name.value: False, # 28.09.2023 #378
|
|
||||||
FeatureFlagsEnum.technician_full_access.value: False, # 03.10.2023 #393
|
|
||||||
FeatureFlagsEnum.steam_special_offers.value: False, # 11.10.2023 #188
|
|
||||||
FeatureFlagsEnum.scheduled_events.value: False, # 14.11.2023 #410
|
|
||||||
FeatureFlagsEnum.basic_registration.value: False, # 19.11.2023 #440
|
|
||||||
FeatureFlagsEnum.basic_login.value: False, # 19.11.2023 #440
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self, **kwargs: dict):
|
|
||||||
ConfigurationModelABC.__init__(self)
|
|
||||||
|
|
||||||
if len(kwargs.keys()) == 0:
|
|
||||||
return
|
|
||||||
|
|
||||||
for flag in [f.value for f in FeatureFlagsEnum]:
|
|
||||||
self._load_flag(kwargs, FeatureFlagsEnum(flag))
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def get_flag_from_dict(cls, flags: dict, key: FeatureFlagsEnum) -> bool:
|
|
||||||
def get_flag():
|
|
||||||
if key.value not in cls._flags:
|
|
||||||
return False
|
|
||||||
return cls._flags[key.value]
|
|
||||||
|
|
||||||
if key.value not in flags:
|
|
||||||
return get_flag()
|
|
||||||
return flags[key.value]
|
|
||||||
|
|
||||||
def get_flag(self, key: FeatureFlagsEnum) -> bool:
|
|
||||||
if key.value not in self._flags:
|
|
||||||
return False
|
|
||||||
return self._flags[key.value]
|
|
||||||
|
|
||||||
def _load_flag(self, settings: dict, key: FeatureFlagsEnum):
|
|
||||||
if key.value not in settings:
|
|
||||||
return
|
|
||||||
|
|
||||||
self._flags[key.value] = bool(settings[key.value])
|
|
@@ -1,2 +0,0 @@
|
|||||||
MIGRATION_ONLY = "MIGRATION_ONLY"
|
|
||||||
MAINTENANCE = "MAINTENANCE"
|
|
@@ -1,15 +0,0 @@
|
|||||||
from cpl_core.configuration import ConfigurationABC
|
|
||||||
from cpl_core.environment import ApplicationEnvironmentABC
|
|
||||||
from cpl_core.time import TimeFormatSettings
|
|
||||||
|
|
||||||
from bot_core.abc.custom_file_logger_abc import CustomFileLoggerABC
|
|
||||||
|
|
||||||
|
|
||||||
class TaskLogger(CustomFileLoggerABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
config: ConfigurationABC,
|
|
||||||
time_format: TimeFormatSettings,
|
|
||||||
env: ApplicationEnvironmentABC,
|
|
||||||
):
|
|
||||||
CustomFileLoggerABC.__init__(self, "Task", config, time_format, env)
|
|
@@ -1,52 +0,0 @@
|
|||||||
from cpl_core.configuration import ConfigurationABC
|
|
||||||
from cpl_core.dependency_injection import ServiceProviderABC
|
|
||||||
|
|
||||||
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
|
||||||
from bot_data.abc.server_config_repository_abc import ServerConfigRepositoryABC
|
|
||||||
from bot_data.abc.technician_config_repository_abc import TechnicianConfigRepositoryABC
|
|
||||||
from bot_data.model.server import Server
|
|
||||||
from bot_data.model.technician_config import TechnicianConfig
|
|
||||||
from bot_data.service.server_config_seeder import ServerConfigSeeder
|
|
||||||
from bot_data.service.technician_config_seeder import TechnicianConfigSeeder
|
|
||||||
|
|
||||||
|
|
||||||
class ConfigService:
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
config: ConfigurationABC,
|
|
||||||
services: ServiceProviderABC,
|
|
||||||
technician_config_repo: TechnicianConfigRepositoryABC,
|
|
||||||
server_config_repo: ServerConfigRepositoryABC,
|
|
||||||
technician_seeder: TechnicianConfigSeeder,
|
|
||||||
server_seeder: ServerConfigSeeder,
|
|
||||||
):
|
|
||||||
self._config = config
|
|
||||||
self._services = services
|
|
||||||
self._technician_config_repo = technician_config_repo
|
|
||||||
self._technician_seeder = technician_seeder
|
|
||||||
self._server_config_repo = server_config_repo
|
|
||||||
|
|
||||||
self._server_seeder = server_seeder
|
|
||||||
|
|
||||||
async def reload_technician_config(self):
|
|
||||||
try:
|
|
||||||
technician_config = self._technician_config_repo.get_technician_config()
|
|
||||||
except Exception as e:
|
|
||||||
await self._technician_seeder.seed()
|
|
||||||
technician_config = self._technician_config_repo.get_technician_config()
|
|
||||||
|
|
||||||
self._config.add_configuration(TechnicianConfig, technician_config)
|
|
||||||
self._config.add_configuration(
|
|
||||||
FeatureFlagsSettings,
|
|
||||||
FeatureFlagsSettings(**technician_config.feature_flags),
|
|
||||||
)
|
|
||||||
|
|
||||||
async def reload_server_config(self, server: Server):
|
|
||||||
if not self._server_config_repo.does_server_config_exists(server.id):
|
|
||||||
await self._server_seeder.seed()
|
|
||||||
|
|
||||||
server_config = self._server_config_repo.get_server_config_by_server(server.id)
|
|
||||||
self._config.add_configuration(
|
|
||||||
f"{type(server_config).__name__}_{server_config.server.discord_id}",
|
|
||||||
server_config,
|
|
||||||
)
|
|
@@ -1,52 +0,0 @@
|
|||||||
from abc import ABC, abstractmethod
|
|
||||||
|
|
||||||
from cpl_query.extension import List
|
|
||||||
|
|
||||||
from bot_data.model.achievement import Achievement
|
|
||||||
from bot_data.model.user_got_achievement import UserGotAchievement
|
|
||||||
|
|
||||||
|
|
||||||
class AchievementRepositoryABC(ABC):
|
|
||||||
@abstractmethod
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def get_achievements(self) -> List[Achievement]:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def get_achievement_by_id(self, id: int) -> Achievement:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def get_achievements_by_server_id(self, server_id: int) -> List[Achievement]:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def get_achievements_by_user_id(self, user_id: int) -> List[Achievement]:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def get_user_got_achievements_by_achievement_id(self, achievement_id: int) -> List[Achievement]:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def add_achievement(self, achievement: Achievement):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def update_achievement(self, achievement: Achievement):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def delete_achievement(self, achievement: Achievement):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def add_user_got_achievement(self, join: UserGotAchievement):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def delete_user_got_achievement(self, join: UserGotAchievement):
|
|
||||||
pass
|
|
@@ -1,32 +0,0 @@
|
|||||||
import os
|
|
||||||
from abc import ABC, abstractmethod
|
|
||||||
|
|
||||||
from cpl_core.dependency_injection import ServiceProviderABC
|
|
||||||
from mysql.connector.cursor import MySQLCursorBuffered
|
|
||||||
|
|
||||||
from bot_data.db_context import DBContext
|
|
||||||
|
|
||||||
|
|
||||||
class MigrationABC(ABC):
|
|
||||||
name = None
|
|
||||||
prio = 0
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
@ServiceProviderABC.inject
|
|
||||||
def __init__(self, db: DBContext):
|
|
||||||
self._cursor: MySQLCursorBuffered = db.cursor
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def upgrade(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def downgrade(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def _exec(self, self_file: str, file: str):
|
|
||||||
path = f"{os.path.dirname(os.path.realpath(self_file))}/db_history_scripts"
|
|
||||||
sql = open(f"{path}/{file}").read()
|
|
||||||
|
|
||||||
for statement in sql.split("\n\n"):
|
|
||||||
self._cursor.execute(statement + ";")
|
|
@@ -1,35 +0,0 @@
|
|||||||
from abc import ABC, abstractmethod
|
|
||||||
|
|
||||||
from cpl_query.extension import List
|
|
||||||
|
|
||||||
from bot_data.model.scheduled_event import ScheduledEvent
|
|
||||||
|
|
||||||
|
|
||||||
class ScheduledEventRepositoryABC(ABC):
|
|
||||||
@abstractmethod
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def get_scheduled_events(self) -> List[ScheduledEvent]:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def get_scheduled_event_by_id(self, id: int) -> ScheduledEvent:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def get_scheduled_events_by_server_id(self, id: int) -> List[ScheduledEvent]:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def add_scheduled_event(self, scheduled_event: ScheduledEvent):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def update_scheduled_event(self, scheduled_event: ScheduledEvent):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def delete_scheduled_event(self, scheduled_event: ScheduledEvent):
|
|
||||||
pass
|
|
@@ -1,59 +0,0 @@
|
|||||||
from abc import ABC, abstractmethod
|
|
||||||
|
|
||||||
from bot_data.model.server_afk_channel_ids_config import ServerAFKChannelIdsConfig
|
|
||||||
from bot_data.model.server_config import ServerConfig
|
|
||||||
from bot_data.model.server_team_role_ids_config import ServerTeamRoleIdsConfig
|
|
||||||
|
|
||||||
|
|
||||||
class ServerConfigRepositoryABC(ABC):
|
|
||||||
@abstractmethod
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def does_server_config_exists(self, server_id: int) -> bool:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def get_server_config_by_server(self, server_id: int) -> ServerConfig:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def get_server_config_by_id(self, config_id: int) -> ServerConfig:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def add_server_config(self, server_config: ServerConfig):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def update_server_config(self, server_config: ServerConfig):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def delete_server_config(self, server_config: ServerConfig):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def add_server_team_role_id_config(self, server_team_role_id: ServerTeamRoleIdsConfig):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def update_server_team_role_id_config(self, server_team_role_id: ServerTeamRoleIdsConfig):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def delete_server_team_role_id_config(self, server_team_role_id: ServerTeamRoleIdsConfig):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def add_server_afk_channel_config(self, server_afk_channel: ServerAFKChannelIdsConfig):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def update_server_afk_channel_config(self, server_afk_channel: ServerAFKChannelIdsConfig):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def delete_server_afk_channel_config(self, server_afk_channel: ServerAFKChannelIdsConfig):
|
|
||||||
pass
|
|
@@ -1,39 +0,0 @@
|
|||||||
from abc import ABC, abstractmethod
|
|
||||||
|
|
||||||
from cpl_query.extension import List
|
|
||||||
|
|
||||||
from bot_data.model.short_role_name import ShortRoleName
|
|
||||||
|
|
||||||
|
|
||||||
class ShortRoleNameRepositoryABC(ABC):
|
|
||||||
@abstractmethod
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def get_short_role_names(self) -> List[ShortRoleName]:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def get_short_role_name_by_id(self, id: int) -> ShortRoleName:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def find_short_role_names_by_role_id(self, role_id: int) -> List[ShortRoleName]:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def get_short_role_names_by_server_id(self, id: int) -> List[ShortRoleName]:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def add_short_role_name(self, short_role_name: ShortRoleName):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def update_short_role_name(self, short_role_name: ShortRoleName):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def delete_short_role_name(self, short_role_name: ShortRoleName):
|
|
||||||
pass
|
|
@@ -1,32 +0,0 @@
|
|||||||
from abc import ABC, abstractmethod
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from cpl_query.extension import List
|
|
||||||
|
|
||||||
from bot_data.model.steam_special_offer import SteamSpecialOffer
|
|
||||||
|
|
||||||
|
|
||||||
class SteamSpecialOfferRepositoryABC(ABC):
|
|
||||||
@abstractmethod
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def get_steam_special_offers(self) -> List[SteamSpecialOffer]:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def get_steam_special_offer_by_name(self, name: str) -> SteamSpecialOffer:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def add_steam_special_offer(self, steam_special_offer: SteamSpecialOffer):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def update_steam_special_offer(self, steam_special_offer: SteamSpecialOffer):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def delete_steam_special_offer(self, steam_special_offer: SteamSpecialOffer):
|
|
||||||
pass
|
|
@@ -1,55 +0,0 @@
|
|||||||
from abc import ABC, abstractmethod
|
|
||||||
|
|
||||||
from bot_data.model.technician_config import TechnicianConfig
|
|
||||||
from bot_data.model.technician_id_config import TechnicianIdConfig
|
|
||||||
from bot_data.model.technician_ping_url_config import TechnicianPingUrlConfig
|
|
||||||
|
|
||||||
|
|
||||||
class TechnicianConfigRepositoryABC(ABC):
|
|
||||||
@abstractmethod
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def does_technician_config_exists(self) -> bool:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def get_technician_config(self) -> TechnicianConfig:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def add_technician_config(self, technician_config: TechnicianConfig):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def update_technician_config(self, technician_config: TechnicianConfig):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def delete_technician_config(self, technician_config: TechnicianConfig):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def add_technician_id_config(self, technician_id: TechnicianIdConfig):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def update_technician_id_config(self, technician_id: TechnicianIdConfig):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def delete_technician_id_config(self, technician_id: TechnicianIdConfig):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def add_technician_ping_url_config(self, technician_ping_url: TechnicianPingUrlConfig):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def update_technician_ping_url_config(self, technician_ping_url: TechnicianPingUrlConfig):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def delete_technician_ping_url_config(self, technician_ping_url: TechnicianPingUrlConfig):
|
|
||||||
pass
|
|
@@ -1,158 +0,0 @@
|
|||||||
from datetime import datetime
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from cpl_core.database import TableABC
|
|
||||||
from cpl_core.dependency_injection import ServiceProviderABC
|
|
||||||
|
|
||||||
from bot_data.model.server import Server
|
|
||||||
|
|
||||||
|
|
||||||
class Achievement(TableABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
name: str,
|
|
||||||
description: str,
|
|
||||||
attribute: str,
|
|
||||||
operator: str,
|
|
||||||
value: str,
|
|
||||||
server: Optional[Server],
|
|
||||||
created_at: datetime = None,
|
|
||||||
modified_at: datetime = None,
|
|
||||||
id=0,
|
|
||||||
):
|
|
||||||
self._id = id
|
|
||||||
self._name = name
|
|
||||||
self._description = description
|
|
||||||
self._attribute = attribute
|
|
||||||
|
|
||||||
if self._is_operator_valid(operator):
|
|
||||||
raise ValueError("Operator invalid")
|
|
||||||
|
|
||||||
self._operator = operator
|
|
||||||
self._value = value
|
|
||||||
self._server = server
|
|
||||||
|
|
||||||
TableABC.__init__(self)
|
|
||||||
self._created_at = created_at if created_at is not None else self._created_at
|
|
||||||
self._modified_at = modified_at if modified_at is not None else self._modified_at
|
|
||||||
|
|
||||||
@ServiceProviderABC.inject
|
|
||||||
def _is_operator_valid(self, operator, service: ServiceProviderABC) -> bool:
|
|
||||||
from modules.achievements.achievement_service import AchievementService
|
|
||||||
|
|
||||||
achievements: AchievementService = service.get_service(AchievementService)
|
|
||||||
return operator not in achievements.get_operators()
|
|
||||||
|
|
||||||
@property
|
|
||||||
def id(self) -> int:
|
|
||||||
return self._id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self) -> str:
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@name.setter
|
|
||||||
def name(self, value: str):
|
|
||||||
self._name = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def description(self) -> str:
|
|
||||||
return self._description
|
|
||||||
|
|
||||||
@description.setter
|
|
||||||
def description(self, value: str):
|
|
||||||
self._description = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def attribute(self) -> str:
|
|
||||||
return self._attribute
|
|
||||||
|
|
||||||
@attribute.setter
|
|
||||||
def attribute(self, value: str):
|
|
||||||
self._attribute = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def operator(self) -> str:
|
|
||||||
return self._operator
|
|
||||||
|
|
||||||
@operator.setter
|
|
||||||
def operator(self, value: str):
|
|
||||||
self._operator = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def value(self) -> str:
|
|
||||||
return self._value
|
|
||||||
|
|
||||||
@value.setter
|
|
||||||
def value(self, value: str):
|
|
||||||
self._value = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def server(self) -> Server:
|
|
||||||
return self._server
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_all_string() -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `Achievements`;
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_id_string(id: int) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `Achievements`
|
|
||||||
WHERE `Id` = {id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_server_id_string(id: int) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `Achievements`
|
|
||||||
WHERE `ServerId` = {id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def insert_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
INSERT INTO `Achievements` (
|
|
||||||
`Name`, `Description`, `Attribute`, `Operator`, `Value`, `ServerId`
|
|
||||||
) VALUES (
|
|
||||||
'{self._name}',
|
|
||||||
'{self._description}',
|
|
||||||
'{self._attribute}',
|
|
||||||
'{self._operator}',
|
|
||||||
'{self._value}',
|
|
||||||
{self._server.id}
|
|
||||||
);
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def udpate_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
UPDATE `Achievements`
|
|
||||||
SET `Name` = '{self._name}',
|
|
||||||
`Description` = '{self._description}',
|
|
||||||
`Attribute` = '{self._attribute}',
|
|
||||||
`Operator` = '{self._operator}',
|
|
||||||
`Value` = '{self._value}'
|
|
||||||
WHERE `Id` = {self._id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def delete_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
DELETE FROM `Achievements`
|
|
||||||
WHERE `Id` = {self._id};
|
|
||||||
"""
|
|
||||||
)
|
|
@@ -1,58 +0,0 @@
|
|||||||
from bot_data.abc.history_table_abc import HistoryTableABC
|
|
||||||
|
|
||||||
|
|
||||||
class AchievementHistory(HistoryTableABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
name: str,
|
|
||||||
description: str,
|
|
||||||
attribute: str,
|
|
||||||
operator: str,
|
|
||||||
value: str,
|
|
||||||
server: int,
|
|
||||||
deleted: bool,
|
|
||||||
date_from: str,
|
|
||||||
date_to: str,
|
|
||||||
id=0,
|
|
||||||
):
|
|
||||||
HistoryTableABC.__init__(self)
|
|
||||||
|
|
||||||
self._id = id
|
|
||||||
self._name = name
|
|
||||||
self._description = description
|
|
||||||
self._attribute = attribute
|
|
||||||
self._operator = operator
|
|
||||||
self._value = value
|
|
||||||
self._server = server
|
|
||||||
|
|
||||||
self._deleted = deleted
|
|
||||||
self._date_from = date_from
|
|
||||||
self._date_to = date_to
|
|
||||||
|
|
||||||
@property
|
|
||||||
def id(self) -> int:
|
|
||||||
return self._id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self) -> str:
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@property
|
|
||||||
def description(self) -> str:
|
|
||||||
return self._description
|
|
||||||
|
|
||||||
@property
|
|
||||||
def attribute(self) -> str:
|
|
||||||
return self._attribute
|
|
||||||
|
|
||||||
@property
|
|
||||||
def operator(self) -> str:
|
|
||||||
return self._operator
|
|
||||||
|
|
||||||
@property
|
|
||||||
def value(self) -> str:
|
|
||||||
return self._value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def server(self) -> int:
|
|
||||||
return self._server
|
|
@@ -1,17 +0,0 @@
|
|||||||
class Migration:
|
|
||||||
def __init__(self, name: str, version: str, script: str):
|
|
||||||
self._name = name
|
|
||||||
self._version = version
|
|
||||||
self._script = script
|
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self) -> str:
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@property
|
|
||||||
def version(self) -> str:
|
|
||||||
return self._version
|
|
||||||
|
|
||||||
@property
|
|
||||||
def script(self) -> str:
|
|
||||||
return self._script
|
|
@@ -1,188 +0,0 @@
|
|||||||
from datetime import datetime
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
import discord
|
|
||||||
from cpl_core.database import TableABC
|
|
||||||
|
|
||||||
from bot_data.model.scheduled_event_interval_enum import ScheduledEventIntervalEnum
|
|
||||||
from bot_data.model.server import Server
|
|
||||||
|
|
||||||
|
|
||||||
class ScheduledEvent(TableABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
interval: ScheduledEventIntervalEnum,
|
|
||||||
name: str,
|
|
||||||
description: str,
|
|
||||||
channel_id: int,
|
|
||||||
start_time: datetime,
|
|
||||||
end_time: Optional[datetime],
|
|
||||||
entity_type: discord.EntityType,
|
|
||||||
location: Optional[str],
|
|
||||||
server: Optional[Server],
|
|
||||||
created_at: datetime = None,
|
|
||||||
modified_at: datetime = None,
|
|
||||||
id=0,
|
|
||||||
):
|
|
||||||
self._id = id
|
|
||||||
self._interval = interval
|
|
||||||
self._name = name
|
|
||||||
self._description = description
|
|
||||||
self._channel_id = channel_id
|
|
||||||
self._start_time = start_time
|
|
||||||
self._end_time = end_time
|
|
||||||
self._entity_type = entity_type
|
|
||||||
self._location = location
|
|
||||||
self._server = server
|
|
||||||
|
|
||||||
TableABC.__init__(self)
|
|
||||||
self._created_at = created_at if created_at is not None else self._created_at
|
|
||||||
self._modified_at = modified_at if modified_at is not None else self._modified_at
|
|
||||||
|
|
||||||
@property
|
|
||||||
def id(self) -> int:
|
|
||||||
return self._id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def interval(self) -> ScheduledEventIntervalEnum:
|
|
||||||
return self._interval
|
|
||||||
|
|
||||||
@interval.setter
|
|
||||||
def interval(self, value: ScheduledEventIntervalEnum):
|
|
||||||
self._interval = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self) -> str:
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@name.setter
|
|
||||||
def name(self, value: str):
|
|
||||||
self._name = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def description(self) -> str:
|
|
||||||
return self._description
|
|
||||||
|
|
||||||
@description.setter
|
|
||||||
def description(self, value: str):
|
|
||||||
self._description = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def channel_id(self) -> int:
|
|
||||||
return self._channel_id
|
|
||||||
|
|
||||||
@channel_id.setter
|
|
||||||
def channel_id(self, value: int):
|
|
||||||
self._channel_id = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def start_time(self) -> datetime:
|
|
||||||
return self._start_time
|
|
||||||
|
|
||||||
@start_time.setter
|
|
||||||
def start_time(self, value: datetime):
|
|
||||||
self._start_time = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def end_time(self) -> datetime:
|
|
||||||
return self._end_time
|
|
||||||
|
|
||||||
@end_time.setter
|
|
||||||
def end_time(self, value: datetime):
|
|
||||||
self._end_time = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def entity_type(self) -> discord.EntityType:
|
|
||||||
return self._entity_type
|
|
||||||
|
|
||||||
@entity_type.setter
|
|
||||||
def entity_type(self, value: discord.EntityType):
|
|
||||||
self._entity_type = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def location(self) -> str:
|
|
||||||
return self._location
|
|
||||||
|
|
||||||
@location.setter
|
|
||||||
def location(self, value: str):
|
|
||||||
self._location = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def server(self) -> Server:
|
|
||||||
return self._server
|
|
||||||
|
|
||||||
@server.setter
|
|
||||||
def server(self, value: Server):
|
|
||||||
self._server = value
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_all_string() -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `ScheduledEvents`;
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_id_string(id: int) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `ScheduledEvents`
|
|
||||||
WHERE `Id` = {id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_server_id_string(s_id: int) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `ScheduledEvents`
|
|
||||||
WHERE `ServerId` = {s_id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def insert_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
INSERT INTO `ScheduledEvents` (
|
|
||||||
`Interval`, `Name`, `Description`, `ChannelId`, `StartTime`, `EndTime`, `EntityType`, `Location`, `ServerId`
|
|
||||||
) VALUES (
|
|
||||||
'{self._interval.value}',
|
|
||||||
'{self._name}',
|
|
||||||
{"NULL" if self._description is None else f"'{self._description}'"},
|
|
||||||
{"NULL" if self._channel_id is None else f"'{self._channel_id}'"},
|
|
||||||
'{self._start_time}',
|
|
||||||
{"NULL" if self._end_time is None else f"'{self._end_time}'"},
|
|
||||||
'{self._entity_type.value}',
|
|
||||||
{"NULL" if self._location is None else f"'{self._location}'"},
|
|
||||||
{self._server.id}
|
|
||||||
);
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def udpate_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
UPDATE `ScheduledEvents`
|
|
||||||
SET `Interval` = '{self._interval.value}',
|
|
||||||
`Name` = '{self._name}',
|
|
||||||
`Description` = {"NULL" if self._description is None else f"'{self._description}'"},
|
|
||||||
`ChannelId` = {"NULL" if self._channel_id is None else f"'{self._channel_id}'"},
|
|
||||||
`StartTime` = '{self._start_time}',
|
|
||||||
`EndTime` = {"NULL" if self._end_time is None else f"'{self._end_time}'"},
|
|
||||||
`EntityType` = '{self._entity_type.value}',
|
|
||||||
`Location` = {"NULL" if self._location is None else f"'{self._location}'"}
|
|
||||||
WHERE `Id` = {self._id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def delete_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
DELETE FROM `ScheduledEvents`
|
|
||||||
WHERE `Id` = {self._id};
|
|
||||||
"""
|
|
||||||
)
|
|
@@ -1,118 +0,0 @@
|
|||||||
from datetime import datetime
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
import discord
|
|
||||||
from cpl_core.database import TableABC
|
|
||||||
|
|
||||||
from bot_data.abc.history_table_abc import HistoryTableABC
|
|
||||||
from bot_data.model.server import Server
|
|
||||||
|
|
||||||
|
|
||||||
class ScheduledEventHistory(HistoryTableABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
interval: str,
|
|
||||||
name: str,
|
|
||||||
description: str,
|
|
||||||
channel_id: int,
|
|
||||||
start_time: datetime,
|
|
||||||
end_time: Optional[datetime],
|
|
||||||
entity_type: discord.EntityType,
|
|
||||||
location: Optional[str],
|
|
||||||
server: Optional[Server],
|
|
||||||
deleted: bool,
|
|
||||||
date_from: str,
|
|
||||||
date_to: str,
|
|
||||||
id=0,
|
|
||||||
):
|
|
||||||
HistoryTableABC.__init__(self)
|
|
||||||
self._id = id
|
|
||||||
self._interval = interval
|
|
||||||
self._name = name
|
|
||||||
self._description = description
|
|
||||||
self._channel_id = channel_id
|
|
||||||
self._start_time = start_time
|
|
||||||
self._end_time = end_time
|
|
||||||
self._entity_type = entity_type
|
|
||||||
self._location = location
|
|
||||||
self._server = server
|
|
||||||
|
|
||||||
self._deleted = deleted
|
|
||||||
self._date_from = date_from
|
|
||||||
self._date_to = date_to
|
|
||||||
|
|
||||||
@property
|
|
||||||
def id(self) -> int:
|
|
||||||
return self._id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def interval(self) -> str:
|
|
||||||
return self._interval
|
|
||||||
|
|
||||||
@interval.setter
|
|
||||||
def interval(self, value: str):
|
|
||||||
self._interval = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self) -> str:
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@name.setter
|
|
||||||
def name(self, value: str):
|
|
||||||
self._name = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def description(self) -> str:
|
|
||||||
return self._description
|
|
||||||
|
|
||||||
@description.setter
|
|
||||||
def description(self, value: str):
|
|
||||||
self._description = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def channel_id(self) -> int:
|
|
||||||
return self._channel_id
|
|
||||||
|
|
||||||
@channel_id.setter
|
|
||||||
def channel_id(self, value: int):
|
|
||||||
self._channel_id = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def start_time(self) -> datetime:
|
|
||||||
return self._start_time
|
|
||||||
|
|
||||||
@start_time.setter
|
|
||||||
def start_time(self, value: datetime):
|
|
||||||
self._start_time = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def end_time(self) -> datetime:
|
|
||||||
return self._end_time
|
|
||||||
|
|
||||||
@end_time.setter
|
|
||||||
def end_time(self, value: datetime):
|
|
||||||
self._end_time = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def entity_type(self) -> discord.EntityType:
|
|
||||||
return self._entity_type
|
|
||||||
|
|
||||||
@entity_type.setter
|
|
||||||
def entity_type(self, value: discord.EntityType):
|
|
||||||
self._entity_type = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def location(self) -> str:
|
|
||||||
return self._location
|
|
||||||
|
|
||||||
@location.setter
|
|
||||||
def location(self, value: str):
|
|
||||||
self._location = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def server(self) -> Server:
|
|
||||||
return self._server
|
|
||||||
|
|
||||||
@server.setter
|
|
||||||
def server(self, value: Server):
|
|
||||||
self._server = value
|
|
@@ -1,8 +0,0 @@
|
|||||||
from enum import Enum
|
|
||||||
|
|
||||||
|
|
||||||
class ScheduledEventIntervalEnum(Enum):
|
|
||||||
daily = "daily"
|
|
||||||
weekly = "weekly"
|
|
||||||
monthly = "monthly"
|
|
||||||
yearly = "yearly"
|
|
@@ -1,85 +0,0 @@
|
|||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from cpl_core.database import TableABC
|
|
||||||
|
|
||||||
|
|
||||||
class ServerAFKChannelIdsConfig(TableABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
channel_id: int,
|
|
||||||
server_id: int,
|
|
||||||
created_at: datetime = None,
|
|
||||||
modified_at: datetime = None,
|
|
||||||
id=0,
|
|
||||||
):
|
|
||||||
self._id = id
|
|
||||||
self._channel_id = channel_id
|
|
||||||
self._server_id = server_id
|
|
||||||
|
|
||||||
TableABC.__init__(self)
|
|
||||||
self._created_at = created_at if created_at is not None else self._created_at
|
|
||||||
self._modified_at = modified_at if modified_at is not None else self._modified_at
|
|
||||||
|
|
||||||
@property
|
|
||||||
def channel_id(self) -> int:
|
|
||||||
return self._channel_id
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_all_string() -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `CFG_ServerAFKChannelIds`;
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_id_string(id: int) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `CFG_ServerAFKChannelIds`
|
|
||||||
WHERE `Id` = {id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_server_id_string(server_id: int) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `CFG_ServerAFKChannelIds`
|
|
||||||
WHERE `ServerId` = {server_id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def insert_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
INSERT INTO `CFG_ServerAFKChannelIds` (
|
|
||||||
`ChannelId`,
|
|
||||||
`ServerId`
|
|
||||||
) VALUES (
|
|
||||||
{self._channel_id},
|
|
||||||
{self._server_id}
|
|
||||||
);
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def udpate_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
UPDATE `CFG_ServerAFKChannelIds`
|
|
||||||
SET `ChannelId` = {self._channel_id},
|
|
||||||
`ServerId` = {self._server_id}
|
|
||||||
WHERE `Id` = {self._id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def delete_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
DELETE FROM `CFG_ServerAFKChannelIds`
|
|
||||||
WHERE `ChannelId` = {self._channel_id};
|
|
||||||
"""
|
|
||||||
)
|
|
@@ -1,374 +0,0 @@
|
|||||||
import json
|
|
||||||
from datetime import datetime
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from cpl_core.configuration import ConfigurationModelABC
|
|
||||||
from cpl_core.database import TableABC
|
|
||||||
from cpl_query.extension import List
|
|
||||||
from discord import Guild
|
|
||||||
|
|
||||||
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
|
||||||
from bot_data.model.server import Server
|
|
||||||
from bot_data.model.server_team_role_ids_config import ServerTeamRoleIdsConfig
|
|
||||||
|
|
||||||
|
|
||||||
class ServerConfig(TableABC, ConfigurationModelABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
message_delete_timer: int,
|
|
||||||
notification_chat_id: int,
|
|
||||||
max_voice_state_hours: int,
|
|
||||||
xp_per_message: int,
|
|
||||||
xp_per_reaction: int,
|
|
||||||
max_message_xp_per_hour: int,
|
|
||||||
xp_per_ontime_hour: int,
|
|
||||||
xp_per_event_participation: int,
|
|
||||||
xp_per_achievement: int,
|
|
||||||
xp_for_birthday: int,
|
|
||||||
afk_command_channel_id: int,
|
|
||||||
help_voice_channel_id: int,
|
|
||||||
team_channel_id: int,
|
|
||||||
login_message_channel_id: int,
|
|
||||||
default_role_id: Optional[int],
|
|
||||||
short_role_name_only_set_highest_role: bool,
|
|
||||||
game_offer_notification_chat_id: int,
|
|
||||||
feature_flags: dict[FeatureFlagsEnum],
|
|
||||||
server: Server,
|
|
||||||
afk_channel_ids: List[int],
|
|
||||||
team_role_ids: List[ServerTeamRoleIdsConfig],
|
|
||||||
created_at: datetime = None,
|
|
||||||
modified_at: datetime = None,
|
|
||||||
id=0,
|
|
||||||
):
|
|
||||||
self._id = id
|
|
||||||
self._message_delete_timer = message_delete_timer
|
|
||||||
self._notification_chat_id = notification_chat_id
|
|
||||||
self._max_voice_state_hours = max_voice_state_hours
|
|
||||||
self._xp_per_message = xp_per_message
|
|
||||||
self._xp_per_reaction = xp_per_reaction
|
|
||||||
self._max_message_xp_per_hour = max_message_xp_per_hour
|
|
||||||
self._xp_per_ontime_hour = xp_per_ontime_hour
|
|
||||||
self._xp_per_event_participation = xp_per_event_participation
|
|
||||||
self._xp_per_achievement = xp_per_achievement
|
|
||||||
self._xp_for_birthday = xp_for_birthday
|
|
||||||
self._afk_command_channel_id = afk_command_channel_id
|
|
||||||
self._help_voice_channel_id = help_voice_channel_id
|
|
||||||
self._team_channel_id = team_channel_id
|
|
||||||
self._login_message_channel_id = login_message_channel_id
|
|
||||||
self._default_role_id = default_role_id
|
|
||||||
self._short_role_name_only_set_highest_role = short_role_name_only_set_highest_role
|
|
||||||
self._game_offer_notification_chat_id = game_offer_notification_chat_id
|
|
||||||
|
|
||||||
self._feature_flags = feature_flags
|
|
||||||
self._server = server
|
|
||||||
self._afk_channel_ids = afk_channel_ids
|
|
||||||
self._team_role_ids = team_role_ids
|
|
||||||
|
|
||||||
TableABC.__init__(self)
|
|
||||||
self._created_at = created_at if created_at is not None else self._created_at
|
|
||||||
self._modified_at = modified_at if modified_at is not None else self._modified_at
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def new(guild: Guild, server: Server) -> "ServerConfig":
|
|
||||||
return ServerConfig(
|
|
||||||
6,
|
|
||||||
guild.system_channel.id,
|
|
||||||
6,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
20,
|
|
||||||
10,
|
|
||||||
10,
|
|
||||||
10,
|
|
||||||
10,
|
|
||||||
guild.system_channel.id,
|
|
||||||
guild.system_channel.id,
|
|
||||||
guild.system_channel.id,
|
|
||||||
guild.system_channel.id,
|
|
||||||
None,
|
|
||||||
False,
|
|
||||||
guild.system_channel.id,
|
|
||||||
{},
|
|
||||||
server,
|
|
||||||
List(int),
|
|
||||||
List(int),
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def id(self) -> int:
|
|
||||||
return self._id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def message_delete_timer(self) -> int:
|
|
||||||
return self._message_delete_timer
|
|
||||||
|
|
||||||
@message_delete_timer.setter
|
|
||||||
def message_delete_timer(self, value: int):
|
|
||||||
self._message_delete_timer = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def notification_chat_id(self) -> int:
|
|
||||||
return self._notification_chat_id
|
|
||||||
|
|
||||||
@notification_chat_id.setter
|
|
||||||
def notification_chat_id(self, value: int):
|
|
||||||
self._notification_chat_id = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def max_voice_state_hours(self) -> int:
|
|
||||||
return self._max_voice_state_hours
|
|
||||||
|
|
||||||
@max_voice_state_hours.setter
|
|
||||||
def max_voice_state_hours(self, value: int):
|
|
||||||
self._max_voice_state_hours = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def xp_per_message(self) -> int:
|
|
||||||
return self._xp_per_message
|
|
||||||
|
|
||||||
@xp_per_message.setter
|
|
||||||
def xp_per_message(self, value: int):
|
|
||||||
self._xp_per_message = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def xp_per_reaction(self) -> int:
|
|
||||||
return self._xp_per_reaction
|
|
||||||
|
|
||||||
@xp_per_reaction.setter
|
|
||||||
def xp_per_reaction(self, value: int):
|
|
||||||
self._xp_per_reaction = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def max_message_xp_per_hour(self) -> int:
|
|
||||||
return self._max_message_xp_per_hour
|
|
||||||
|
|
||||||
@max_message_xp_per_hour.setter
|
|
||||||
def max_message_xp_per_hour(self, value: int):
|
|
||||||
self._max_message_xp_per_hour = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def xp_per_ontime_hour(self) -> int:
|
|
||||||
return self._xp_per_ontime_hour
|
|
||||||
|
|
||||||
@xp_per_ontime_hour.setter
|
|
||||||
def xp_per_ontime_hour(self, value: int):
|
|
||||||
self._xp_per_ontime_hour = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def xp_per_event_participation(self) -> int:
|
|
||||||
return self._xp_per_event_participation
|
|
||||||
|
|
||||||
@xp_per_event_participation.setter
|
|
||||||
def xp_per_event_participation(self, value: int):
|
|
||||||
self._xp_per_event_participation = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def xp_per_achievement(self) -> int:
|
|
||||||
return self._xp_per_achievement
|
|
||||||
|
|
||||||
@xp_per_achievement.setter
|
|
||||||
def xp_per_achievement(self, value: int):
|
|
||||||
self._xp_per_achievement = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def xp_for_birthday(self) -> int:
|
|
||||||
return self._xp_for_birthday
|
|
||||||
|
|
||||||
@xp_for_birthday.setter
|
|
||||||
def xp_for_birthday(self, value: int):
|
|
||||||
self._xp_for_birthday = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def afk_command_channel_id(self) -> int:
|
|
||||||
return self._afk_command_channel_id
|
|
||||||
|
|
||||||
@afk_command_channel_id.setter
|
|
||||||
def afk_command_channel_id(self, value: int):
|
|
||||||
self._afk_command_channel_id = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def help_voice_channel_id(self) -> int:
|
|
||||||
return self._help_voice_channel_id
|
|
||||||
|
|
||||||
@help_voice_channel_id.setter
|
|
||||||
def help_voice_channel_id(self, value: int):
|
|
||||||
self._help_voice_channel_id = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def team_channel_id(self) -> int:
|
|
||||||
return self._team_channel_id
|
|
||||||
|
|
||||||
@team_channel_id.setter
|
|
||||||
def team_channel_id(self, value: int):
|
|
||||||
self._team_channel_id = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def login_message_channel_id(self) -> int:
|
|
||||||
return self._login_message_channel_id
|
|
||||||
|
|
||||||
@login_message_channel_id.setter
|
|
||||||
def login_message_channel_id(self, value: int):
|
|
||||||
self._login_message_channel_id = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def default_role_id(self) -> int:
|
|
||||||
return self._default_role_id
|
|
||||||
|
|
||||||
@default_role_id.setter
|
|
||||||
def default_role_id(self, value: int):
|
|
||||||
self._default_role_id = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def short_role_name_only_set_highest_role(self) -> bool:
|
|
||||||
return self._short_role_name_only_set_highest_role
|
|
||||||
|
|
||||||
@short_role_name_only_set_highest_role.setter
|
|
||||||
def short_role_name_only_set_highest_role(self, value: bool):
|
|
||||||
self._short_role_name_only_set_highest_role = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def game_offer_notification_chat_id(self) -> int:
|
|
||||||
return self._game_offer_notification_chat_id
|
|
||||||
|
|
||||||
@game_offer_notification_chat_id.setter
|
|
||||||
def game_offer_notification_chat_id(self, value: int):
|
|
||||||
self._game_offer_notification_chat_id = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def feature_flags(self) -> dict[FeatureFlagsEnum]:
|
|
||||||
return self._feature_flags
|
|
||||||
|
|
||||||
@feature_flags.setter
|
|
||||||
def feature_flags(self, value: dict[FeatureFlagsEnum]):
|
|
||||||
self._feature_flags = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def afk_channel_ids(self) -> List[int]:
|
|
||||||
return self._afk_channel_ids
|
|
||||||
|
|
||||||
@afk_channel_ids.setter
|
|
||||||
def afk_channel_ids(self, value: List[int]):
|
|
||||||
self._afk_channel_ids = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def team_role_ids(self) -> List[ServerTeamRoleIdsConfig]:
|
|
||||||
return self._team_role_ids
|
|
||||||
|
|
||||||
@team_role_ids.setter
|
|
||||||
def team_role_ids(self, value: List[ServerTeamRoleIdsConfig]):
|
|
||||||
self._team_role_ids = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def server(self) -> Server:
|
|
||||||
return self._server
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_all_string() -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `CFG_Server`;
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_id_string(id: int) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `CFG_Server`
|
|
||||||
WHERE `Id` = {id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_server_id_string(server_id: int) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `CFG_Server`
|
|
||||||
WHERE `ServerId` = {server_id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def insert_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
INSERT INTO `CFG_Server` (
|
|
||||||
`MessageDeleteTimer`,
|
|
||||||
`NotificationChatId`,
|
|
||||||
`MaxVoiceStateHours`,
|
|
||||||
`XpPerMessage`,
|
|
||||||
`XpPerReaction`,
|
|
||||||
`MaxMessageXpPerHour`,
|
|
||||||
`XpPerOntimeHour`,
|
|
||||||
`XpPerEventParticipation`,
|
|
||||||
`XpPerAchievement`,
|
|
||||||
`XpForBirthday`,
|
|
||||||
`AFKCommandChannelId`,
|
|
||||||
`HelpVoiceChannelId`,
|
|
||||||
`TeamChannelId`,
|
|
||||||
`LoginMessageChannelId`,
|
|
||||||
`DefaultRoleId`,
|
|
||||||
`ShortRoleNameSetOnlyHighest`,
|
|
||||||
`GameOfferNotificationChatId`,
|
|
||||||
`FeatureFlags`,
|
|
||||||
`ServerId`
|
|
||||||
) VALUES (
|
|
||||||
{self._message_delete_timer},
|
|
||||||
{self._notification_chat_id},
|
|
||||||
{self._max_voice_state_hours},
|
|
||||||
{self._xp_per_message},
|
|
||||||
{self._xp_per_reaction},
|
|
||||||
{self._max_message_xp_per_hour},
|
|
||||||
{self._xp_per_ontime_hour},
|
|
||||||
{self._xp_per_event_participation},
|
|
||||||
{self._xp_per_achievement},
|
|
||||||
'{self._xp_for_birthday}',
|
|
||||||
{self._afk_command_channel_id},
|
|
||||||
{self._help_voice_channel_id},
|
|
||||||
{self._team_channel_id},
|
|
||||||
{self._login_message_channel_id},
|
|
||||||
{"NULL" if self._default_role_id is None else self._default_role_id},
|
|
||||||
{self._short_role_name_only_set_highest_role},
|
|
||||||
{self._game_offer_notification_chat_id},
|
|
||||||
'{json.dumps(self._feature_flags)}',
|
|
||||||
{self._server.id}
|
|
||||||
);
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def udpate_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
UPDATE `CFG_Server`
|
|
||||||
SET `MessageDeleteTimer` = {self._message_delete_timer},
|
|
||||||
`NotificationChatId` = {self._notification_chat_id},
|
|
||||||
`MaxVoiceStateHours` = {self._max_voice_state_hours},
|
|
||||||
`XpPerMessage` = {self._xp_per_message},
|
|
||||||
`XpPerReaction` = {self._xp_per_reaction},
|
|
||||||
`MaxMessageXpPerHour` = {self._max_message_xp_per_hour},
|
|
||||||
`XpPerOntimeHour` = {self._xp_per_ontime_hour},
|
|
||||||
`XpPerEventParticipation` = {self._xp_per_event_participation},
|
|
||||||
`XpPerAchievement` = {self._xp_per_achievement},
|
|
||||||
`XpForBirthday` = {self._xp_for_birthday},
|
|
||||||
`AFKCommandChannelId` = {self._afk_command_channel_id},
|
|
||||||
`HelpVoiceChannelId` = {self._help_voice_channel_id},
|
|
||||||
`TeamChannelId` = {self._team_channel_id},
|
|
||||||
`LoginMessageChannelId` = {self._login_message_channel_id},
|
|
||||||
`DefaultRoleId` = {"NULL" if self._default_role_id is None else self._default_role_id},
|
|
||||||
`ShortRoleNameSetOnlyHighest` = {self._short_role_name_only_set_highest_role},
|
|
||||||
`GameOfferNotificationChatId` = {self._game_offer_notification_chat_id},
|
|
||||||
`FeatureFlags` = '{json.dumps(self._feature_flags)}',
|
|
||||||
`ServerId` = {self._server.id}
|
|
||||||
WHERE `Id` = {self._id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def delete_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
DELETE FROM `CFG_Server`
|
|
||||||
WHERE `Id` = {self._id};
|
|
||||||
"""
|
|
||||||
)
|
|
@@ -1,121 +0,0 @@
|
|||||||
from bot_data.abc.history_table_abc import HistoryTableABC
|
|
||||||
|
|
||||||
|
|
||||||
class ServerConfigHistory(HistoryTableABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
message_delete_timer: int,
|
|
||||||
notification_chat_id: int,
|
|
||||||
max_voice_state_hours: int,
|
|
||||||
xp_per_message: int,
|
|
||||||
xp_per_reaction: int,
|
|
||||||
max_message_xp_per_hour: int,
|
|
||||||
xp_per_ontime_hour: int,
|
|
||||||
xp_per_event_participation: int,
|
|
||||||
xp_per_achievement: int,
|
|
||||||
afk_command_channel_id: int,
|
|
||||||
help_voice_channel_id: int,
|
|
||||||
team_channel_id: int,
|
|
||||||
login_message_channel_id: int,
|
|
||||||
default_role_id: int,
|
|
||||||
short_role_name_only_set_highest_role: bool,
|
|
||||||
feature_flags: dict[str],
|
|
||||||
server_id: int,
|
|
||||||
deleted: bool,
|
|
||||||
date_from: str,
|
|
||||||
date_to: str,
|
|
||||||
id=0,
|
|
||||||
):
|
|
||||||
HistoryTableABC.__init__(self)
|
|
||||||
|
|
||||||
self._id = id
|
|
||||||
self._message_delete_timer = message_delete_timer
|
|
||||||
self._notification_chat_id = notification_chat_id
|
|
||||||
self._max_voice_state_hours = max_voice_state_hours
|
|
||||||
self._xp_per_message = xp_per_message
|
|
||||||
self._xp_per_reaction = xp_per_reaction
|
|
||||||
self._max_message_xp_per_hour = max_message_xp_per_hour
|
|
||||||
self._xp_per_ontime_hour = xp_per_ontime_hour
|
|
||||||
self._xp_per_event_participation = xp_per_event_participation
|
|
||||||
self._xp_per_achievement = xp_per_achievement
|
|
||||||
self._afk_command_channel_id = afk_command_channel_id
|
|
||||||
self._help_voice_channel_id = help_voice_channel_id
|
|
||||||
self._team_channel_id = team_channel_id
|
|
||||||
self._login_message_channel_id = login_message_channel_id
|
|
||||||
self._default_role_id = default_role_id
|
|
||||||
self._short_role_name_only_set_highest_role = short_role_name_only_set_highest_role
|
|
||||||
|
|
||||||
self._feature_flags = feature_flags
|
|
||||||
self._server_id = server_id
|
|
||||||
|
|
||||||
self._deleted = deleted
|
|
||||||
self._date_from = date_from
|
|
||||||
self._date_to = date_to
|
|
||||||
|
|
||||||
@property
|
|
||||||
def message_delete_timer(self) -> int:
|
|
||||||
return self._message_delete_timer
|
|
||||||
|
|
||||||
@property
|
|
||||||
def notification_chat_id(self) -> int:
|
|
||||||
return self._notification_chat_id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def max_voice_state_hours(self) -> int:
|
|
||||||
return self._max_voice_state_hours
|
|
||||||
|
|
||||||
@property
|
|
||||||
def xp_per_message(self) -> int:
|
|
||||||
return self._xp_per_message
|
|
||||||
|
|
||||||
@property
|
|
||||||
def xp_per_reaction(self) -> int:
|
|
||||||
return self._xp_per_reaction
|
|
||||||
|
|
||||||
@property
|
|
||||||
def max_message_xp_per_hour(self) -> int:
|
|
||||||
return self._max_message_xp_per_hour
|
|
||||||
|
|
||||||
@property
|
|
||||||
def xp_per_ontime_hour(self) -> int:
|
|
||||||
return self._xp_per_ontime_hour
|
|
||||||
|
|
||||||
@property
|
|
||||||
def xp_per_event_participation(self) -> int:
|
|
||||||
return self._xp_per_event_participation
|
|
||||||
|
|
||||||
@property
|
|
||||||
def xp_per_achievement(self) -> int:
|
|
||||||
return self._xp_per_achievement
|
|
||||||
|
|
||||||
@property
|
|
||||||
def afk_command_channel_id(self) -> int:
|
|
||||||
return self._afk_command_channel_id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def help_voice_channel_id(self) -> int:
|
|
||||||
return self._help_voice_channel_id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def team_channel_id(self) -> int:
|
|
||||||
return self._team_channel_id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def login_message_channel_id(self) -> int:
|
|
||||||
return self._login_message_channel_id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def default_role_id(self) -> int:
|
|
||||||
return self._default_role_id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def short_role_name_only_set_highest_role(self) -> bool:
|
|
||||||
return self._short_role_name_only_set_highest_role
|
|
||||||
|
|
||||||
@property
|
|
||||||
def feature_flags(self) -> dict[str]:
|
|
||||||
return self._feature_flags
|
|
||||||
|
|
||||||
@property
|
|
||||||
def server_id(self) -> int:
|
|
||||||
return self._server_id
|
|
@@ -1,100 +0,0 @@
|
|||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from cpl_core.database import TableABC
|
|
||||||
|
|
||||||
from bot_data.model.team_member_type_enum import TeamMemberTypeEnum
|
|
||||||
|
|
||||||
|
|
||||||
class ServerTeamRoleIdsConfig(TableABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
role_id: int,
|
|
||||||
team_member_type: TeamMemberTypeEnum,
|
|
||||||
server_id: int,
|
|
||||||
created_at: datetime = None,
|
|
||||||
modified_at: datetime = None,
|
|
||||||
id=0,
|
|
||||||
):
|
|
||||||
self._id = id
|
|
||||||
self._role_id = role_id
|
|
||||||
self._team_member_type = team_member_type
|
|
||||||
self._server_id = server_id
|
|
||||||
|
|
||||||
TableABC.__init__(self)
|
|
||||||
self._created_at = created_at if created_at is not None else self._created_at
|
|
||||||
self._modified_at = modified_at if modified_at is not None else self._modified_at
|
|
||||||
|
|
||||||
@property
|
|
||||||
def id(self) -> int:
|
|
||||||
return self._id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def role_id(self) -> int:
|
|
||||||
return self._role_id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def team_member_type(self) -> TeamMemberTypeEnum:
|
|
||||||
return self._team_member_type
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_all_string() -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `CFG_ServerTeamRoleIds`;
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_id_string(id: int) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `CFG_ServerTeamRoleIds`
|
|
||||||
WHERE `Id` = {id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_server_id_string(server_id: int) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `CFG_ServerTeamRoleIds`
|
|
||||||
WHERE `ServerId` = {server_id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def insert_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
INSERT INTO `CFG_ServerTeamRoleIds` (
|
|
||||||
`RoleId`,
|
|
||||||
`TeamMemberType`,
|
|
||||||
`ServerId`
|
|
||||||
) VALUES (
|
|
||||||
{self._role_id},
|
|
||||||
'{self._team_member_type.value}',
|
|
||||||
{self._server_id}
|
|
||||||
);
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def udpate_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
UPDATE `CFG_ServerTeamRoleIds`
|
|
||||||
SET `RoleId` = {self._role_id},
|
|
||||||
`TeamMemberType` = '{self._team_member_type.value}',
|
|
||||||
`ServerId` = {self._server_id}
|
|
||||||
WHERE `Id` = {self._id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def delete_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
DELETE FROM `CFG_ServerTeamRoleIds`
|
|
||||||
WHERE `RoleId` = {self._role_id};
|
|
||||||
"""
|
|
||||||
)
|
|
@@ -1,140 +0,0 @@
|
|||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from cpl_core.database import TableABC
|
|
||||||
from cpl_core.dependency_injection import ServiceProviderABC
|
|
||||||
from cpl_discord.service import DiscordBotServiceABC
|
|
||||||
|
|
||||||
from bot_data.model.server import Server
|
|
||||||
from bot_data.model.short_role_name_position_enum import ShortRoleNamePositionEnum
|
|
||||||
|
|
||||||
|
|
||||||
class ShortRoleName(TableABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
short_name: str,
|
|
||||||
discord_role_id: int,
|
|
||||||
position: ShortRoleNamePositionEnum,
|
|
||||||
server: Server,
|
|
||||||
created_at: datetime = None,
|
|
||||||
modified_at: datetime = None,
|
|
||||||
id=0,
|
|
||||||
):
|
|
||||||
self._id = id
|
|
||||||
self._short_name = short_name
|
|
||||||
self._discord_role_id = discord_role_id
|
|
||||||
self._position = position
|
|
||||||
self._server = server
|
|
||||||
|
|
||||||
TableABC.__init__(self)
|
|
||||||
self._created_at = created_at if created_at is not None else self._created_at
|
|
||||||
self._modified_at = modified_at if modified_at is not None else self._modified_at
|
|
||||||
|
|
||||||
@property
|
|
||||||
def id(self) -> int:
|
|
||||||
return self._id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def short_name(self) -> str:
|
|
||||||
return self._short_name
|
|
||||||
|
|
||||||
@short_name.setter
|
|
||||||
def short_name(self, value: str):
|
|
||||||
self._short_name = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def role_id(self) -> int:
|
|
||||||
return self._discord_role_id
|
|
||||||
|
|
||||||
@role_id.setter
|
|
||||||
def role_id(self, value: int):
|
|
||||||
self._discord_role_id = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
@ServiceProviderABC.inject
|
|
||||||
def role_name(self, bot: DiscordBotServiceABC) -> str:
|
|
||||||
guild = bot.get_guild(self._server.discord_id)
|
|
||||||
return guild.get_role(self.role_id).name
|
|
||||||
|
|
||||||
@property
|
|
||||||
def position(self) -> ShortRoleNamePositionEnum:
|
|
||||||
return self._position
|
|
||||||
|
|
||||||
@position.setter
|
|
||||||
def position(self, value: ShortRoleNamePositionEnum):
|
|
||||||
self._position = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def server(self) -> Server:
|
|
||||||
return self._server
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_all_string() -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `ShortRoleNames`;
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_id_string(id: int) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `ShortRoleNames`
|
|
||||||
WHERE `Id` = {id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_role_id_string(id: int) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `ShortRoleNames`
|
|
||||||
WHERE `DiscordRoleId` = {id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_server_id_string(id: int) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `ShortRoleNames`
|
|
||||||
WHERE `ServerId` = {id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def insert_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
INSERT INTO `ShortRoleNames` (
|
|
||||||
`ShortName`, `DiscordRoleId`, `Position`, `ServerId`
|
|
||||||
) VALUES (
|
|
||||||
'{self._short_name}',
|
|
||||||
{self._discord_role_id},
|
|
||||||
'{self._position}',
|
|
||||||
{self._server.id}
|
|
||||||
);
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def udpate_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
UPDATE `ShortRoleNames`
|
|
||||||
SET `ShortName` = '{self._short_name}',
|
|
||||||
`DiscordRoleId` = {self._discord_role_id},
|
|
||||||
`Position` = '{self._position}',
|
|
||||||
`ServerId` = {self._server.id}
|
|
||||||
WHERE `Id` = {self._id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def delete_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
DELETE FROM `ShortRoleNames`
|
|
||||||
WHERE `Id` = {self._id};
|
|
||||||
"""
|
|
||||||
)
|
|
@@ -1,56 +0,0 @@
|
|||||||
from cpl_core.dependency_injection import ServiceProviderABC
|
|
||||||
from cpl_discord.service import DiscordBotServiceABC
|
|
||||||
|
|
||||||
from bot_data.abc.history_table_abc import HistoryTableABC
|
|
||||||
|
|
||||||
|
|
||||||
class ShortRoleNameHistory(HistoryTableABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
name: str,
|
|
||||||
discord_role_id: int,
|
|
||||||
server: int,
|
|
||||||
deleted: bool,
|
|
||||||
date_from: str,
|
|
||||||
date_to: str,
|
|
||||||
id=0,
|
|
||||||
):
|
|
||||||
HistoryTableABC.__init__(self)
|
|
||||||
self._id = id
|
|
||||||
self._name = name
|
|
||||||
self._discord_role_id = discord_role_id
|
|
||||||
self._server = server
|
|
||||||
|
|
||||||
self._deleted = deleted
|
|
||||||
self._date_from = date_from
|
|
||||||
self._date_to = date_to
|
|
||||||
|
|
||||||
@property
|
|
||||||
def id(self) -> int:
|
|
||||||
return self._id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self) -> str:
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@name.setter
|
|
||||||
def name(self, value: str):
|
|
||||||
self._name = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def role_id(self) -> int:
|
|
||||||
return self._discord_role_id
|
|
||||||
|
|
||||||
@role_id.setter
|
|
||||||
def role_id(self, value: int):
|
|
||||||
self._discord_role_id = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
@ServiceProviderABC.inject
|
|
||||||
def role_name(self, bot: DiscordBotServiceABC) -> str:
|
|
||||||
guild = bot.get_guild(self._server.discord_id)
|
|
||||||
return guild.get_role(self.role_id).name
|
|
||||||
|
|
||||||
@property
|
|
||||||
def server(self) -> int:
|
|
||||||
return self._server
|
|
@@ -1,6 +0,0 @@
|
|||||||
from enum import Enum
|
|
||||||
|
|
||||||
|
|
||||||
class ShortRoleNamePositionEnum(Enum):
|
|
||||||
before = "before"
|
|
||||||
after = "after"
|
|
@@ -1,115 +0,0 @@
|
|||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from cpl_core.database import TableABC
|
|
||||||
|
|
||||||
|
|
||||||
class SteamSpecialOffer(TableABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
name: str,
|
|
||||||
original_price: float,
|
|
||||||
discount_price: float,
|
|
||||||
discount_pct: int,
|
|
||||||
created_at: datetime = None,
|
|
||||||
modified_at: datetime = None,
|
|
||||||
id=0,
|
|
||||||
):
|
|
||||||
self._id = id
|
|
||||||
self._name = name
|
|
||||||
self._original_price = original_price
|
|
||||||
self._discount_price = discount_price
|
|
||||||
self._discount_pct = discount_pct
|
|
||||||
|
|
||||||
TableABC.__init__(self)
|
|
||||||
self._created_at = created_at if created_at is not None else self._created_at
|
|
||||||
self._modified_at = modified_at if modified_at is not None else self._modified_at
|
|
||||||
|
|
||||||
@property
|
|
||||||
def id(self) -> int:
|
|
||||||
return self._id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self) -> str:
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@name.setter
|
|
||||||
def name(self, value: str):
|
|
||||||
self._name = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def original_price(self) -> float:
|
|
||||||
return self._original_price
|
|
||||||
|
|
||||||
@original_price.setter
|
|
||||||
def original_price(self, value: float):
|
|
||||||
self._original_price = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def discount_price(self) -> float:
|
|
||||||
return self._discount_price
|
|
||||||
|
|
||||||
@discount_price.setter
|
|
||||||
def discount_price(self, value: float):
|
|
||||||
self._discount_price = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def discount_pct(self) -> int:
|
|
||||||
return self._discount_pct
|
|
||||||
|
|
||||||
@discount_pct.setter
|
|
||||||
def discount_pct(self, value: int):
|
|
||||||
self._discount_pct = value
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_all_string() -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `SteamSpecialOffers`;
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_name_string(name: str) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `SteamSpecialOffers`
|
|
||||||
WHERE `Game` = '{name}';
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def insert_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
INSERT INTO `SteamSpecialOffers` (
|
|
||||||
`Game`, `OriginalPrice`, `DiscountPrice`, `DiscountPct`
|
|
||||||
) VALUES (
|
|
||||||
'{self._name}',
|
|
||||||
{self._original_price},
|
|
||||||
{self._discount_price},
|
|
||||||
{self._discount_pct}
|
|
||||||
);
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def udpate_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
UPDATE `SteamSpecialOffers`
|
|
||||||
SET `Game` = '{self._name}',
|
|
||||||
`OriginalPrice` = {self._original_price},
|
|
||||||
`DiscountPrice` = {self._discount_price},
|
|
||||||
`DiscountPct` = {self._discount_pct}
|
|
||||||
WHERE `Id` = {self._id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def delete_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
DELETE FROM `SteamSpecialOffers`
|
|
||||||
WHERE `Id` = {self._id};
|
|
||||||
"""
|
|
||||||
)
|
|
@@ -1,6 +0,0 @@
|
|||||||
from enum import Enum
|
|
||||||
|
|
||||||
|
|
||||||
class TeamMemberTypeEnum(Enum):
|
|
||||||
moderator = "Moderator"
|
|
||||||
admin = "Admin"
|
|
@@ -1,175 +0,0 @@
|
|||||||
import json
|
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from cpl_core.configuration import ConfigurationModelABC
|
|
||||||
from cpl_core.database import TableABC
|
|
||||||
from cpl_query.extension import List
|
|
||||||
|
|
||||||
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
|
||||||
|
|
||||||
|
|
||||||
class TechnicianConfig(TableABC, ConfigurationModelABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
help_command_reference_url: str,
|
|
||||||
wait_for_restart: int,
|
|
||||||
wait_for_shutdown: int,
|
|
||||||
cache_max_messages: int,
|
|
||||||
max_steam_offer_count: int,
|
|
||||||
maintenance: bool,
|
|
||||||
feature_flags: dict[FeatureFlagsEnum],
|
|
||||||
technician_ids: List[int],
|
|
||||||
ping_urls: List[str],
|
|
||||||
created_at: datetime = None,
|
|
||||||
modified_at: datetime = None,
|
|
||||||
id=0,
|
|
||||||
):
|
|
||||||
self._id = id
|
|
||||||
self._help_command_reference_url = help_command_reference_url
|
|
||||||
self._wait_for_restart = wait_for_restart
|
|
||||||
self._wait_for_shutdown = wait_for_shutdown
|
|
||||||
self._cache_max_messages = cache_max_messages
|
|
||||||
self._max_steam_offer_count = max_steam_offer_count
|
|
||||||
self._maintenance = maintenance
|
|
||||||
|
|
||||||
self._feature_flags = feature_flags
|
|
||||||
self._technician_ids = technician_ids
|
|
||||||
self._ping_urls = ping_urls
|
|
||||||
|
|
||||||
TableABC.__init__(self)
|
|
||||||
self._created_at = created_at if created_at is not None else self._created_at
|
|
||||||
self._modified_at = modified_at if modified_at is not None else self._modified_at
|
|
||||||
|
|
||||||
@property
|
|
||||||
def id(self) -> int:
|
|
||||||
return self._id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def help_command_reference_url(self) -> str:
|
|
||||||
return self._help_command_reference_url
|
|
||||||
|
|
||||||
@help_command_reference_url.setter
|
|
||||||
def help_command_reference_url(self, value: str):
|
|
||||||
self._help_command_reference_url = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def wait_for_restart(self) -> int:
|
|
||||||
return self._wait_for_restart
|
|
||||||
|
|
||||||
@wait_for_restart.setter
|
|
||||||
def wait_for_restart(self, value: int):
|
|
||||||
self._wait_for_restart = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def wait_for_shutdown(self) -> int:
|
|
||||||
return self._wait_for_shutdown
|
|
||||||
|
|
||||||
@wait_for_shutdown.setter
|
|
||||||
def wait_for_shutdown(self, value: int):
|
|
||||||
self._wait_for_shutdown = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def cache_max_messages(self) -> int:
|
|
||||||
return self._cache_max_messages
|
|
||||||
|
|
||||||
@cache_max_messages.setter
|
|
||||||
def cache_max_messages(self, value: int):
|
|
||||||
self._cache_max_messages = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def max_steam_offer_count(self) -> int:
|
|
||||||
return self._max_steam_offer_count
|
|
||||||
|
|
||||||
@max_steam_offer_count.setter
|
|
||||||
def max_steam_offer_count(self, value: int):
|
|
||||||
self._max_steam_offer_count = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def feature_flags(self) -> dict[FeatureFlagsEnum]:
|
|
||||||
return self._feature_flags
|
|
||||||
|
|
||||||
@feature_flags.setter
|
|
||||||
def feature_flags(self, value: dict[FeatureFlagsEnum]):
|
|
||||||
self._feature_flags = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def technician_ids(self) -> List[int]:
|
|
||||||
return self._technician_ids
|
|
||||||
|
|
||||||
@technician_ids.setter
|
|
||||||
def technician_ids(self, value: List[int]):
|
|
||||||
self._technician_ids = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def ping_urls(self) -> List[str]:
|
|
||||||
return self._ping_urls
|
|
||||||
|
|
||||||
@ping_urls.setter
|
|
||||||
def ping_urls(self, value: List[str]):
|
|
||||||
self._ping_urls = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def maintenance(self) -> bool:
|
|
||||||
return self._maintenance
|
|
||||||
|
|
||||||
@maintenance.setter
|
|
||||||
def maintenance(self, value: bool):
|
|
||||||
self._maintenance = value
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_all_string() -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `CFG_Technician`;
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_id_string(id: int) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `CFG_Technician`
|
|
||||||
WHERE `Id` = {id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def insert_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
INSERT INTO `CFG_Technician` (
|
|
||||||
`HelpCommandReferenceUrl`, `WaitForRestart`, `WaitForShutdown`, `CacheMaxMessages`, `MaxSteamOfferCount`, `FeatureFlags`
|
|
||||||
) VALUES (
|
|
||||||
'{self._help_command_reference_url}',
|
|
||||||
{self._wait_for_restart},
|
|
||||||
{self._wait_for_shutdown},
|
|
||||||
{self._cache_max_messages},
|
|
||||||
{self._max_steam_offer_count},
|
|
||||||
'{json.dumps(self._feature_flags)}'
|
|
||||||
);
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def udpate_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
UPDATE `CFG_Technician`
|
|
||||||
SET `HelpCommandReferenceUrl` = '{self._help_command_reference_url}',
|
|
||||||
`WaitForRestart` = {self._wait_for_restart},
|
|
||||||
`WaitForShutdown` = {self._wait_for_shutdown},
|
|
||||||
`CacheMaxMessages` = {self._cache_max_messages},
|
|
||||||
`MaxSteamOfferCount` = {self._max_steam_offer_count},
|
|
||||||
`FeatureFlags` = '{json.dumps(self._feature_flags)}'
|
|
||||||
WHERE `Id` = {self._id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def delete_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
DELETE FROM `CFG_Technician`
|
|
||||||
WHERE `Id` = {self._id};
|
|
||||||
"""
|
|
||||||
)
|
|
@@ -1,58 +0,0 @@
|
|||||||
from bot_data.abc.history_table_abc import HistoryTableABC
|
|
||||||
|
|
||||||
|
|
||||||
class TechnicianConfigHistory(HistoryTableABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
help_command_reference_url: str,
|
|
||||||
wait_for_restart: int,
|
|
||||||
wait_for_shutdown: int,
|
|
||||||
cache_max_messages: int,
|
|
||||||
deleted: bool,
|
|
||||||
date_from: str,
|
|
||||||
date_to: str,
|
|
||||||
id=0,
|
|
||||||
):
|
|
||||||
HistoryTableABC.__init__(self)
|
|
||||||
|
|
||||||
self._id = id
|
|
||||||
self._help_command_reference_url = help_command_reference_url
|
|
||||||
self._wait_for_restart = wait_for_restart
|
|
||||||
self._wait_for_shutdown = wait_for_shutdown
|
|
||||||
self._cache_max_messages = cache_max_messages
|
|
||||||
|
|
||||||
self._deleted = deleted
|
|
||||||
self._date_from = date_from
|
|
||||||
self._date_to = date_to
|
|
||||||
|
|
||||||
@property
|
|
||||||
def help_command_reference_url(self) -> str:
|
|
||||||
return self._help_command_reference_url
|
|
||||||
|
|
||||||
@help_command_reference_url.setter
|
|
||||||
def help_command_reference_url(self, value: str):
|
|
||||||
self._help_command_reference_url = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def wait_for_restart(self) -> int:
|
|
||||||
return self._wait_for_restart
|
|
||||||
|
|
||||||
@wait_for_restart.setter
|
|
||||||
def wait_for_restart(self, value: int):
|
|
||||||
self._wait_for_restart = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def wait_for_shutdown(self) -> int:
|
|
||||||
return self._wait_for_shutdown
|
|
||||||
|
|
||||||
@wait_for_shutdown.setter
|
|
||||||
def wait_for_shutdown(self, value: int):
|
|
||||||
self._wait_for_shutdown = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def cache_max_messages(self) -> int:
|
|
||||||
return self._cache_max_messages
|
|
||||||
|
|
||||||
@cache_max_messages.setter
|
|
||||||
def cache_max_messages(self, value: int):
|
|
||||||
self._cache_max_messages = value
|
|
@@ -1,79 +0,0 @@
|
|||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from cpl_core.database import TableABC
|
|
||||||
|
|
||||||
|
|
||||||
class TechnicianIdConfig(TableABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
technician_id: str,
|
|
||||||
created_at: datetime = None,
|
|
||||||
modified_at: datetime = None,
|
|
||||||
id=0,
|
|
||||||
):
|
|
||||||
self._id = id
|
|
||||||
self._technician_id = technician_id
|
|
||||||
|
|
||||||
TableABC.__init__(self)
|
|
||||||
self._created_at = created_at if created_at is not None else self._created_at
|
|
||||||
self._modified_at = modified_at if modified_at is not None else self._modified_at
|
|
||||||
|
|
||||||
@property
|
|
||||||
def id(self) -> int:
|
|
||||||
return self._id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def technician_id(self) -> str:
|
|
||||||
return self._technician_id
|
|
||||||
|
|
||||||
@technician_id.setter
|
|
||||||
def technician_id(self, value: str):
|
|
||||||
self._technician_id = value
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_all_string() -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `CFG_TechnicianIds`;
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_id_string(id: int) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `CFG_TechnicianIds`
|
|
||||||
WHERE `Id` = {id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def insert_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
INSERT INTO `CFG_TechnicianIds` (
|
|
||||||
`TechnicianId`
|
|
||||||
) VALUES (
|
|
||||||
'{self._technician_id}'
|
|
||||||
);
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def udpate_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
UPDATE `CFG_TechnicianIds`
|
|
||||||
SET `TechnicianId` = '{self._technician_id}'
|
|
||||||
WHERE `Id` = {self._id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def delete_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
DELETE FROM `CFG_TechnicianIds`
|
|
||||||
WHERE `TechnicianId` = {self._technician_id};
|
|
||||||
"""
|
|
||||||
)
|
|
@@ -1,28 +0,0 @@
|
|||||||
from bot_data.abc.history_table_abc import HistoryTableABC
|
|
||||||
|
|
||||||
|
|
||||||
class TechnicianIdConfigHistory(HistoryTableABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
technician_id: int,
|
|
||||||
deleted: bool,
|
|
||||||
date_from: str,
|
|
||||||
date_to: str,
|
|
||||||
id=0,
|
|
||||||
):
|
|
||||||
HistoryTableABC.__init__(self)
|
|
||||||
|
|
||||||
self._id = id
|
|
||||||
self._technician_id = technician_id
|
|
||||||
|
|
||||||
self._deleted = deleted
|
|
||||||
self._date_from = date_from
|
|
||||||
self._date_to = date_to
|
|
||||||
|
|
||||||
@property
|
|
||||||
def technician_id(self) -> int:
|
|
||||||
return self._technician_id
|
|
||||||
|
|
||||||
@technician_id.setter
|
|
||||||
def technician_id(self, value: int):
|
|
||||||
self._technician_id = value
|
|
@@ -1,79 +0,0 @@
|
|||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from cpl_core.database import TableABC
|
|
||||||
|
|
||||||
|
|
||||||
class TechnicianPingUrlConfig(TableABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
ping_url: str,
|
|
||||||
created_at: datetime = None,
|
|
||||||
modified_at: datetime = None,
|
|
||||||
id=0,
|
|
||||||
):
|
|
||||||
self._id = id
|
|
||||||
self._ping_url = ping_url
|
|
||||||
|
|
||||||
TableABC.__init__(self)
|
|
||||||
self._created_at = created_at if created_at is not None else self._created_at
|
|
||||||
self._modified_at = modified_at if modified_at is not None else self._modified_at
|
|
||||||
|
|
||||||
@property
|
|
||||||
def id(self) -> int:
|
|
||||||
return self._id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def ping_url(self) -> str:
|
|
||||||
return self._ping_url
|
|
||||||
|
|
||||||
@ping_url.setter
|
|
||||||
def ping_url(self, value: str):
|
|
||||||
self._ping_url = value
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_all_string() -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `CFG_TechnicianPingUrls`;
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_id_string(id: int) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `CFG_TechnicianPingUrls`
|
|
||||||
WHERE `Id` = {id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def insert_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
INSERT INTO `CFG_TechnicianPingUrls` (
|
|
||||||
`URL`
|
|
||||||
) VALUES (
|
|
||||||
'{self._ping_url}'
|
|
||||||
);
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def udpate_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
UPDATE `CFG_TechnicianPingUrls`
|
|
||||||
SET `URL` = '{self._ping_url}'
|
|
||||||
WHERE `Id` = {self._id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def delete_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
DELETE FROM `CFG_TechnicianPingUrls`
|
|
||||||
WHERE `URL` = '{self._ping_url}';
|
|
||||||
"""
|
|
||||||
)
|
|
@@ -1,28 +0,0 @@
|
|||||||
from bot_data.abc.history_table_abc import HistoryTableABC
|
|
||||||
|
|
||||||
|
|
||||||
class TechnicianPingUrlConfigHistory(HistoryTableABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
url: str,
|
|
||||||
deleted: bool,
|
|
||||||
date_from: str,
|
|
||||||
date_to: str,
|
|
||||||
id=0,
|
|
||||||
):
|
|
||||||
HistoryTableABC.__init__(self)
|
|
||||||
|
|
||||||
self._id = id
|
|
||||||
self._url = url
|
|
||||||
|
|
||||||
self._deleted = deleted
|
|
||||||
self._date_from = date_from
|
|
||||||
self._date_to = date_to
|
|
||||||
|
|
||||||
@property
|
|
||||||
def url(self) -> str:
|
|
||||||
return self._url
|
|
||||||
|
|
||||||
@url.setter
|
|
||||||
def url(self, value: str):
|
|
||||||
self._url = value
|
|
@@ -1,105 +0,0 @@
|
|||||||
from datetime import datetime
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from cpl_core.database import TableABC
|
|
||||||
|
|
||||||
from bot_data.model.achievement import Achievement
|
|
||||||
from bot_data.model.user import User
|
|
||||||
|
|
||||||
|
|
||||||
class UserGotAchievement(TableABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
user: Optional[User],
|
|
||||||
achievement: Optional[Achievement],
|
|
||||||
created_at: datetime = None,
|
|
||||||
modified_at: datetime = None,
|
|
||||||
id=0,
|
|
||||||
):
|
|
||||||
self._id = id
|
|
||||||
self._user = user
|
|
||||||
self._achievement = achievement
|
|
||||||
|
|
||||||
TableABC.__init__(self)
|
|
||||||
self._created_at = created_at if created_at is not None else self._created_at
|
|
||||||
self._modified_at = modified_at if modified_at is not None else self._modified_at
|
|
||||||
|
|
||||||
@property
|
|
||||||
def id(self) -> int:
|
|
||||||
return self._id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def user(self) -> User:
|
|
||||||
return self._user
|
|
||||||
|
|
||||||
@property
|
|
||||||
def achievement(self) -> Achievement:
|
|
||||||
return self._achievement
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_all_string() -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `UserGotAchievements`;
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_id_string(id: int) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `UserGotAchievements`
|
|
||||||
WHERE `Id` = {id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_user_id_string(id: int) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `UserGotAchievements`
|
|
||||||
WHERE `UserId` = {id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_select_by_achievement_id_string(id: int) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
SELECT * FROM `UserGotAchievements`
|
|
||||||
WHERE `AchievementId` = {id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def insert_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
INSERT INTO `UserGotAchievements` (
|
|
||||||
`UserId`, `AchievementId`
|
|
||||||
) VALUES (
|
|
||||||
{self._user.id},
|
|
||||||
{self._achievement.id}
|
|
||||||
);
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def udpate_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
UPDATE `UserGotAchievements`
|
|
||||||
SET `UserId` = '{self._user.id}',
|
|
||||||
`AchievementId` = '{self._achievement.id}'
|
|
||||||
WHERE `Id` = {self._id};
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def delete_string(self) -> str:
|
|
||||||
return str(
|
|
||||||
f"""
|
|
||||||
DELETE FROM `UserGotAchievements`
|
|
||||||
WHERE `Id` = {self._id};
|
|
||||||
"""
|
|
||||||
)
|
|
@@ -1,43 +0,0 @@
|
|||||||
from typing import Optional
|
|
||||||
|
|
||||||
from bot_data.abc.history_table_abc import HistoryTableABC
|
|
||||||
|
|
||||||
|
|
||||||
# had to name it UserWarnings instead of UserWarning because UserWarning is a builtin class
|
|
||||||
class UserWarningsHistory(HistoryTableABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
description: str,
|
|
||||||
user: int,
|
|
||||||
author: Optional[int],
|
|
||||||
deleted: bool,
|
|
||||||
date_from: str,
|
|
||||||
date_to: str,
|
|
||||||
id=0,
|
|
||||||
):
|
|
||||||
HistoryTableABC.__init__(self)
|
|
||||||
|
|
||||||
self._id = id
|
|
||||||
self._description = description
|
|
||||||
self._user = user
|
|
||||||
self._author = author
|
|
||||||
|
|
||||||
self._deleted = deleted
|
|
||||||
self._date_from = date_from
|
|
||||||
self._date_to = date_to
|
|
||||||
|
|
||||||
@property
|
|
||||||
def id(self) -> int:
|
|
||||||
return self._id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def description(self) -> str:
|
|
||||||
return self._description
|
|
||||||
|
|
||||||
@property
|
|
||||||
def user(self) -> int:
|
|
||||||
return self._user
|
|
||||||
|
|
||||||
@property
|
|
||||||
def author(self) -> Optional[int]:
|
|
||||||
return self._author
|
|
@@ -1,12 +0,0 @@
|
|||||||
DROP TABLE `Servers`;
|
|
||||||
|
|
||||||
DROP TABLE `Users`;
|
|
||||||
|
|
||||||
DROP TABLE `Clients`;
|
|
||||||
|
|
||||||
DROP TABLE `KnownUsers`;
|
|
||||||
|
|
||||||
DROP TABLE `UserJoinedServers`;
|
|
||||||
|
|
||||||
DROP TABLE `UserJoinedVoiceChannel`;
|
|
||||||
|
|
@@ -1,80 +0,0 @@
|
|||||||
CREATE TABLE IF NOT EXISTS `MigrationHistory`
|
|
||||||
(
|
|
||||||
`MigrationId` VARCHAR(255),
|
|
||||||
`CreatedAt` DATETIME(6),
|
|
||||||
`LastModifiedAt` DATETIME(6),
|
|
||||||
PRIMARY KEY (`MigrationId`)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `Servers`
|
|
||||||
(
|
|
||||||
`ServerId` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`DiscordServerId` BIGINT NOT NULL,
|
|
||||||
`CreatedAt` DATETIME(6),
|
|
||||||
`LastModifiedAt` DATETIME(6),
|
|
||||||
PRIMARY KEY (`ServerId`)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `Users`
|
|
||||||
(
|
|
||||||
`UserId` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`DiscordId` BIGINT NOT NULL,
|
|
||||||
`XP` BIGINT NOT NULL DEFAULT 0,
|
|
||||||
`ServerId` BIGINT,
|
|
||||||
`CreatedAt` DATETIME(6),
|
|
||||||
`LastModifiedAt` DATETIME(6),
|
|
||||||
FOREIGN KEY (`ServerId`) REFERENCES Servers (`ServerId`),
|
|
||||||
PRIMARY KEY (`UserId`)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `Clients`
|
|
||||||
(
|
|
||||||
`ClientId` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`DiscordClientId` BIGINT NOT NULL,
|
|
||||||
`SentMessageCount` BIGINT NOT NULL DEFAULT 0,
|
|
||||||
`ReceivedMessageCount` BIGINT NOT NULL DEFAULT 0,
|
|
||||||
`DeletedMessageCount` BIGINT NOT NULL DEFAULT 0,
|
|
||||||
`ReceivedCommandsCount` BIGINT NOT NULL DEFAULT 0,
|
|
||||||
`MovedUsersCount` BIGINT NOT NULL DEFAULT 0,
|
|
||||||
`ServerId` BIGINT,
|
|
||||||
`CreatedAt` DATETIME(6),
|
|
||||||
`LastModifiedAt` DATETIME(6),
|
|
||||||
FOREIGN KEY (`ServerId`) REFERENCES Servers (`ServerId`),
|
|
||||||
PRIMARY KEY (`ClientId`)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `KnownUsers`
|
|
||||||
(
|
|
||||||
`KnownUserId` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`DiscordId` BIGINT NOT NULL,
|
|
||||||
`CreatedAt` DATETIME(6),
|
|
||||||
`LastModifiedAt` DATETIME(6),
|
|
||||||
PRIMARY KEY (`KnownUserId`)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `UserJoinedServers`
|
|
||||||
(
|
|
||||||
`JoinId` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`UserId` BIGINT NOT NULL,
|
|
||||||
`JoinedOn` DATETIME(6) NOT NULL,
|
|
||||||
`LeavedOn` DATETIME(6),
|
|
||||||
`CreatedAt` DATETIME(6),
|
|
||||||
`LastModifiedAt` DATETIME(6),
|
|
||||||
FOREIGN KEY (`UserId`) REFERENCES Users (`UserId`),
|
|
||||||
PRIMARY KEY (`JoinId`)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `UserJoinedVoiceChannel`
|
|
||||||
(
|
|
||||||
`JoinId` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`UserId` BIGINT NOT NULL,
|
|
||||||
`DiscordChannelId` BIGINT NOT NULL,
|
|
||||||
`JoinedOn` DATETIME(6) NOT NULL,
|
|
||||||
`LeavedOn` DATETIME(6),
|
|
||||||
`CreatedAt` DATETIME(6),
|
|
||||||
`LastModifiedAt` DATETIME(6),
|
|
||||||
FOREIGN KEY (`UserId`) REFERENCES Users (`UserId`),
|
|
||||||
PRIMARY KEY (`JoinId`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
@@ -1,4 +0,0 @@
|
|||||||
DROP TABLE `AutoRoleRules`;
|
|
||||||
|
|
||||||
|
|
||||||
DROP TABLE `AutoRoles`;
|
|
@@ -1,26 +0,0 @@
|
|||||||
CREATE TABLE IF NOT EXISTS `AutoRoles`
|
|
||||||
(
|
|
||||||
`AutoRoleId` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`ServerId` BIGINT,
|
|
||||||
`DiscordMessageId` BIGINT NOT NULL,
|
|
||||||
`CreatedAt` DATETIME(6),
|
|
||||||
`LastModifiedAt` DATETIME(6),
|
|
||||||
PRIMARY KEY (`AutoRoleId`),
|
|
||||||
FOREIGN KEY (`ServerId`) REFERENCES `Servers` (`ServerId`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `AutoRoleRules`
|
|
||||||
(
|
|
||||||
`AutoRoleRuleId` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`AutoRoleId` BIGINT,
|
|
||||||
`DiscordEmojiName` VARCHAR(64),
|
|
||||||
`DiscordRoleId` BIGINT NOT NULL,
|
|
||||||
`CreatedAt` DATETIME(6),
|
|
||||||
`LastModifiedAt` DATETIME(6),
|
|
||||||
PRIMARY KEY (`AutoRoleRuleId`),
|
|
||||||
FOREIGN KEY (`AutoRoleId`) REFERENCES `AutoRoles` (`AutoRoleId`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
@@ -1,4 +0,0 @@
|
|||||||
DROP TABLE `AuthUserUsersRelations`;
|
|
||||||
|
|
||||||
|
|
||||||
DROP TABLE `AuthUsers`;
|
|
@@ -1,34 +0,0 @@
|
|||||||
CREATE TABLE IF NOT EXISTS `AuthUsers`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`FirstName` VARCHAR(255),
|
|
||||||
`LastName` VARCHAR(255),
|
|
||||||
`EMail` VARCHAR(255),
|
|
||||||
`Password` VARCHAR(255),
|
|
||||||
`PasswordSalt` VARCHAR(255),
|
|
||||||
`RefreshToken` VARCHAR(255),
|
|
||||||
`ConfirmationId` VARCHAR(255) DEFAULT NULL,
|
|
||||||
`ForgotPasswordId` VARCHAR(255) DEFAULT NULL,
|
|
||||||
`OAuthId` VARCHAR(255) DEFAULT NULL,
|
|
||||||
`RefreshTokenExpiryTime` DATETIME(6) NOT NULL,
|
|
||||||
`AuthRole` INT NOT NULL DEFAULT 0,
|
|
||||||
`CreatedAt` DATETIME(6) NOT NULL,
|
|
||||||
`LastModifiedAt` DATETIME(6) NOT NULL,
|
|
||||||
PRIMARY KEY (`Id`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `AuthUserUsersRelations`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`AuthUserId` BIGINT DEFAULT NULL,
|
|
||||||
`UserId` BIGINT DEFAULT NULL,
|
|
||||||
`CreatedAt` DATETIME(6) NOT NULL,
|
|
||||||
`LastModifiedAt` DATETIME(6) NOT NULL,
|
|
||||||
PRIMARY KEY (`Id`),
|
|
||||||
FOREIGN KEY (`AuthUserId`) REFERENCES `AuthUsers` (`Id`),
|
|
||||||
FOREIGN KEY (`UserId`) REFERENCES `Users` (`UserId`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
@@ -1,2 +0,0 @@
|
|||||||
DROP TABLE `Levels`;
|
|
||||||
|
|
@@ -1,15 +0,0 @@
|
|||||||
CREATE TABLE IF NOT EXISTS `Levels`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`Name` VARCHAR(255) NOT NULL,
|
|
||||||
`Color` VARCHAR(8) NOT NULL,
|
|
||||||
`MinXp` BIGINT NOT NULL,
|
|
||||||
`PermissionInt` BIGINT NOT NULL,
|
|
||||||
`ServerId` BIGINT,
|
|
||||||
`CreatedAt` DATETIME(6),
|
|
||||||
`LastModifiedAt` DATETIME(6),
|
|
||||||
PRIMARY KEY (`Id`),
|
|
||||||
FOREIGN KEY (`ServerId`) REFERENCES `Servers` (`ServerId`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
@@ -1,2 +0,0 @@
|
|||||||
DROP TABLE `Statistics`;
|
|
||||||
|
|
@@ -1,14 +0,0 @@
|
|||||||
CREATE TABLE IF NOT EXISTS `Statistics`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`Name` VARCHAR(255) NOT NULL,
|
|
||||||
`Description` VARCHAR(255) NOT NULL,
|
|
||||||
`Code` LONGTEXT NOT NULL,
|
|
||||||
`ServerId` BIGINT,
|
|
||||||
`CreatedAt` DATETIME(6),
|
|
||||||
`LastModifiedAt` DATETIME(6),
|
|
||||||
PRIMARY KEY (`Id`),
|
|
||||||
FOREIGN KEY (`ServerId`) REFERENCES `Servers` (`ServerId`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
@@ -1,4 +0,0 @@
|
|||||||
ALTER TABLE AutoRoles
|
|
||||||
DROP COLUMN DiscordChannelId;
|
|
||||||
|
|
||||||
|
|
@@ -1,4 +0,0 @@
|
|||||||
ALTER TABLE AutoRoles
|
|
||||||
ADD DiscordChannelId BIGINT NOT NULL AFTER ServerId;
|
|
||||||
|
|
||||||
|
|
@@ -1,2 +0,0 @@
|
|||||||
DROP TABLE `UserMessageCountPerHour`;
|
|
||||||
|
|
@@ -1,14 +0,0 @@
|
|||||||
CREATE TABLE IF NOT EXISTS `UserMessageCountPerHour`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`Date` DATETIME(6) NOT NULL,
|
|
||||||
`Hour` BIGINT,
|
|
||||||
`XPCount` BIGINT,
|
|
||||||
`UserId` BIGINT,
|
|
||||||
`CreatedAt` DATETIME(6),
|
|
||||||
`LastModifiedAt` DATETIME(6),
|
|
||||||
PRIMARY KEY (`Id`),
|
|
||||||
FOREIGN KEY (`UserId`) REFERENCES `Users` (`UserId`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
@@ -1,2 +0,0 @@
|
|||||||
DROP TABLE `ApiKeys`;
|
|
||||||
|
|
@@ -1,15 +0,0 @@
|
|||||||
CREATE TABLE IF NOT EXISTS `ApiKeys`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`Identifier` VARCHAR(255) NOT NULL,
|
|
||||||
`Key` VARCHAR(255) NOT NULL,
|
|
||||||
`CreatorId` BIGINT NULL,
|
|
||||||
`CreatedAt` DATETIME(6),
|
|
||||||
`LastModifiedAt` DATETIME(6),
|
|
||||||
PRIMARY KEY (`Id`),
|
|
||||||
FOREIGN KEY (`CreatorId`) REFERENCES `Users` (`UserId`),
|
|
||||||
CONSTRAINT UC_Identifier_Key UNIQUE (`Identifier`, `Key`),
|
|
||||||
CONSTRAINT UC_Key UNIQUE (`Key`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
@@ -1,8 +0,0 @@
|
|||||||
DROP TABLE `UserJoinedGameServer`;
|
|
||||||
|
|
||||||
|
|
||||||
DROP TABLE `UserGameIdents`;
|
|
||||||
|
|
||||||
|
|
||||||
DROP TABLE `GameServers`;
|
|
||||||
|
|
@@ -1,46 +0,0 @@
|
|||||||
CREATE TABLE IF NOT EXISTS `GameServers`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`Name` VARCHAR(255) NOT NULL,
|
|
||||||
`ServerId` BIGINT NOT NULL,
|
|
||||||
`ApiKeyId` BIGINT NOT NULL,
|
|
||||||
`CreatedAt` DATETIME(6),
|
|
||||||
`LastModifiedAt` DATETIME(6),
|
|
||||||
FOREIGN KEY (`ServerId`) REFERENCES Servers (`ServerId`),
|
|
||||||
FOREIGN KEY (`ApiKeyId`) REFERENCES ApiKeys (`Id`),
|
|
||||||
PRIMARY KEY (`Id`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `UserJoinedGameServer`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`UserId` BIGINT NOT NULL,
|
|
||||||
`GameServerId` BIGINT NOT NULL,
|
|
||||||
`JoinedOn` DATETIME(6) NOT NULL,
|
|
||||||
`LeavedOn` DATETIME(6),
|
|
||||||
`CreatedAt` DATETIME(6),
|
|
||||||
`LastModifiedAt` DATETIME(6),
|
|
||||||
FOREIGN KEY (`UserId`) REFERENCES Users (`UserId`),
|
|
||||||
FOREIGN KEY (`GameServerId`) REFERENCES GameServers (`Id`),
|
|
||||||
PRIMARY KEY (`Id`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `UserGameIdents`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`UserId` BIGINT NOT NULL,
|
|
||||||
`GameServerId` BIGINT NOT NULL,
|
|
||||||
`Ident` VARCHAR(255) NOT NULL,
|
|
||||||
`CreatedAt` DATETIME(6),
|
|
||||||
`LastModifiedAt` DATETIME(6),
|
|
||||||
FOREIGN KEY (`UserId`) REFERENCES Users (`UserId`),
|
|
||||||
FOREIGN KEY (`GameServerId`) REFERENCES GameServers (`Id`),
|
|
||||||
CONSTRAINT UC_UserGameIdent UNIQUE (`GameServerId`, `Ident`),
|
|
||||||
PRIMARY KEY (`Id`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
@@ -1,14 +0,0 @@
|
|||||||
CREATE TABLE IF NOT EXISTS `Statistics`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`Name` VARCHAR(255) NOT NULL,
|
|
||||||
`Description` VARCHAR(255) NOT NULL,
|
|
||||||
`Code` LONGTEXT NOT NULL,
|
|
||||||
`ServerId` BIGINT,
|
|
||||||
`CreatedAt` DATETIME(6),
|
|
||||||
`LastModifiedAt` DATETIME(6),
|
|
||||||
PRIMARY KEY (`Id`),
|
|
||||||
FOREIGN KEY (`ServerId`) REFERENCES `Servers` (`ServerId`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
@@ -1,3 +0,0 @@
|
|||||||
DROP TABLE IF EXISTS `Statistics`;
|
|
||||||
|
|
||||||
|
|
@@ -1,2 +0,0 @@
|
|||||||
DROP TABLE `UserWarnings`;
|
|
||||||
|
|
@@ -1,14 +0,0 @@
|
|||||||
CREATE TABLE IF NOT EXISTS `UserWarnings`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`Description` VARCHAR(255) NOT NULL,
|
|
||||||
`UserId` BIGINT NOT NULL,
|
|
||||||
`Author` BIGINT NULL,
|
|
||||||
`CreatedAt` DATETIME(6),
|
|
||||||
`LastModifiedAt` DATETIME(6),
|
|
||||||
PRIMARY KEY (`Id`),
|
|
||||||
FOREIGN KEY (`UserId`) REFERENCES `Users` (`UserId`),
|
|
||||||
FOREIGN KEY (`Author`) REFERENCES `Users` (`UserId`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
@@ -1,34 +0,0 @@
|
|||||||
DROP TABLE `ApiKeysHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `AuthUsersHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `AuthUserUsersRelationsHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `AutoRoleRulesHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `AutoRolesHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `ClientsHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `GameServersHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `KnownUsersHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `LevelsHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `ServersHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `UserGameIdentsHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `UserJoinedGameServerHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `UserJoinedServersHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `UserJoinedVoiceChannelHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `UserMessageCountPerHourHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `UsersHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `UserWarningsHistory`;
|
|
||||||
|
|
@@ -1,711 +0,0 @@
|
|||||||
ALTER TABLE `ApiKeys`
|
|
||||||
CHANGE `CreatedAt` `CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
ALTER TABLE `ApiKeys`
|
|
||||||
CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `ApiKeysHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`Identifier` VARCHAR(255) NOT NULL,
|
|
||||||
`Key` VARCHAR(255) NOT NULL,
|
|
||||||
`CreatorId` BIGINT(20) DEFAULT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_ApiKeysUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_ApiKeysUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `ApiKeys`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `ApiKeysHistory` (`Id`, `Identifier`, `Key`, `CreatorId`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.Identifier, OLD.Key, OLD.CreatorId, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_ApiKeysDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_ApiKeysDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `ApiKeys`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `ApiKeysHistory` (`Id`, `Identifier`, `Key`, `CreatorId`, `Deleted`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.Identifier, OLD.Key, OLD.CreatorId, TRUE, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
ALTER TABLE `AuthUsers`
|
|
||||||
CHANGE `CreatedAt` `CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
ALTER TABLE `AuthUsers`
|
|
||||||
CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `AuthUsersHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`FirstName` VARCHAR(255) DEFAULT NULL,
|
|
||||||
`LastName` VARCHAR(255) DEFAULT NULL,
|
|
||||||
`EMail` VARCHAR(255) DEFAULT NULL,
|
|
||||||
`Password` VARCHAR(255) DEFAULT NULL,
|
|
||||||
`PasswordSalt` VARCHAR(255) DEFAULT NULL,
|
|
||||||
`RefreshToken` VARCHAR(255) DEFAULT NULL,
|
|
||||||
`ConfirmationId` VARCHAR(255) DEFAULT NULL,
|
|
||||||
`ForgotPasswordId` VARCHAR(255) DEFAULT NULL,
|
|
||||||
`OAuthId` VARCHAR(255) DEFAULT NULL,
|
|
||||||
`RefreshTokenExpiryTime` DATETIME(6) NOT NULL,
|
|
||||||
`AuthRole` BIGINT(11) NOT NULL DEFAULT 0,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_AuthUsersUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_AuthUsersUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `AuthUsers`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `AuthUsersHistory` (`Id`, `FirstName`, `LastName`, `EMail`, `Password`, `PasswordSalt`,
|
|
||||||
`RefreshToken`, `ConfirmationId`, `ForgotPasswordId`, `OAuthId`,
|
|
||||||
`RefreshTokenExpiryTime`, `AuthRole`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.FirstName, OLD.LastName, OLD.EMail, OLD.Password, OLD.PasswordSalt, OLD.RefreshToken,
|
|
||||||
OLD.ConfirmationId, OLD.ForgotPasswordId, OLD.OAuthId, OLD.RefreshTokenExpiryTime, OLD.AuthRole,
|
|
||||||
OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_AuthUsersDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_AuthUsersDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `AuthUsers`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `AuthUsersHistory` (`Id`, `FirstName`, `LastName`, `EMail`, `Password`, `PasswordSalt`, `RefreshToken`,
|
|
||||||
`ConfirmationId`, `ForgotPasswordId`, `OAuthId`, `RefreshTokenExpiryTime`,
|
|
||||||
`AuthRole`, `Deleted`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.FirstName, OLD.LastName, OLD.EMail, OLD.Password, OLD.PasswordSalt, OLD.RefreshToken,
|
|
||||||
OLD.ConfirmationId, OLD.ForgotPasswordId, OLD.OAuthId, OLD.RefreshTokenExpiryTime, OLD.AuthRole, TRUE,
|
|
||||||
OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
ALTER TABLE `AuthUserUsersRelations`
|
|
||||||
CHANGE `CreatedAt` `CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
ALTER TABLE `AuthUserUsersRelations`
|
|
||||||
CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `AuthUserUsersRelationsHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`AuthUserId` BIGINT(20) DEFAULT NULL,
|
|
||||||
`UserId` BIGINT(20) DEFAULT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_AuthUserUsersRelationsUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_AuthUserUsersRelationsUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `AuthUserUsersRelations`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `AuthUserUsersRelationsHistory` (`Id`, `AuthUserId`, `UserId`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.AuthUserId, OLD.UserId, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_AuthUserUsersRelationsDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_AuthUserUsersRelationsDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `AuthUserUsersRelations`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `AuthUserUsersRelationsHistory` (`Id`, `AuthUserId`, `UserId`, `Deleted`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.AuthUserId, OLD.UserId, TRUE, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
ALTER TABLE `AutoRoleRules`
|
|
||||||
CHANGE `CreatedAt` `CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
ALTER TABLE `AutoRoleRules`
|
|
||||||
CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `AutoRoleRulesHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`AutoRoleId` BIGINT(20) DEFAULT NULL,
|
|
||||||
`DiscordEmojiName` VARCHAR(64) DEFAULT NULL,
|
|
||||||
`DiscordRoleId` BIGINT(20) NOT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_AutoRoleRulesUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_AutoRoleRulesUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `AutoRoleRules`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `AutoRoleRulesHistory` (`Id`, `AutoRoleId`, `DiscordEmojiName`, `DiscordRoleId`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.AutoRoleRuleId, OLD.AutoRoleId, OLD.DiscordEmojiName, OLD.DiscordRoleId, OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_AutoRoleRulesDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_AutoRoleRulesDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `AutoRoleRules`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `AutoRoleRulesHistory` (`Id`, `AutoRoleId`, `DiscordEmojiName`, `DiscordRoleId`, `Deleted`, `DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.AutoRoleRuleId, OLD.AutoRoleId, OLD.DiscordEmojiName, OLD.DiscordRoleId, TRUE, OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
ALTER TABLE `AutoRoles`
|
|
||||||
CHANGE `CreatedAt` `CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
ALTER TABLE `AutoRoles`
|
|
||||||
CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `AutoRolesHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`ServerId` BIGINT(20) DEFAULT NULL,
|
|
||||||
`DiscordChannelId` BIGINT(20) NOT NULL,
|
|
||||||
`DiscordMessageId` BIGINT(20) NOT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_AutoRolesUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_AutoRolesUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `AutoRoles`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `AutoRolesHistory` (`Id`, `ServerId`, `DiscordChannelId`, `DiscordMessageId`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.AutoRoleId, OLD.ServerId, OLD.DiscordChannelId, OLD.DiscordMessageId, OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_AutoRolesDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_AutoRolesDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `AutoRoles`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `AutoRolesHistory` (`Id`, `ServerId`, `DiscordChannelId`, `DiscordMessageId`, `Deleted`, `DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.AutoRoleId, OLD.ServerId, OLD.DiscordChannelId, OLD.DiscordMessageId, TRUE, OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
ALTER TABLE `Clients`
|
|
||||||
CHANGE `CreatedAt` `CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
ALTER TABLE `Clients`
|
|
||||||
CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `ClientsHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`DiscordId` BIGINT(20) NOT NULL,
|
|
||||||
`SentMessageCount` BIGINT(20) NOT NULL DEFAULT 0,
|
|
||||||
`ReceivedMessageCount` BIGINT(20) NOT NULL DEFAULT 0,
|
|
||||||
`DeletedMessageCount` BIGINT(20) NOT NULL DEFAULT 0,
|
|
||||||
`ReceivedCommandsCount` BIGINT(20) NOT NULL DEFAULT 0,
|
|
||||||
`MovedUsersCount` BIGINT(20) NOT NULL DEFAULT 0,
|
|
||||||
`ServerId` BIGINT(20) DEFAULT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_ClientsUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_ClientsUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `Clients`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `ClientsHistory` (`Id`, `DiscordId`, `SentMessageCount`, `ReceivedMessageCount`, `DeletedMessageCount`,
|
|
||||||
`ReceivedCommandsCount`, `MovedUsersCount`, `ServerId`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.ClientId, OLD.DiscordClientId, OLD.SentMessageCount, OLD.ReceivedMessageCount, OLD.DeletedMessageCount,
|
|
||||||
OLD.ReceivedCommandsCount, OLD.MovedUsersCount, OLD.ServerId, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_ClientsDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_ClientsDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `Clients`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `ClientsHistory` (`Id`, `DiscordId`, `SentMessageCount`, `ReceivedMessageCount`, `DeletedMessageCount`,
|
|
||||||
`ReceivedCommandsCount`, `MovedUsersCount`, `ServerId`, `Deleted`, `DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.ClientId, OLD.DiscordClientId, OLD.SentMessageCount, OLD.ReceivedMessageCount, OLD.DeletedMessageCount,
|
|
||||||
OLD.ReceivedCommandsCount, OLD.MovedUsersCount, OLD.ServerId, TRUE, OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
ALTER TABLE `GameServers`
|
|
||||||
CHANGE `CreatedAt` `CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
ALTER TABLE `GameServers`
|
|
||||||
CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `GameServersHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`Name` VARCHAR(255) NOT NULL,
|
|
||||||
`ServerId` BIGINT(20) NOT NULL,
|
|
||||||
`ApiKeyId` BIGINT(20) NOT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_GameServersUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_GameServersUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `GameServers`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `GameServersHistory` (`Id`, `Name`, `ServerId`, `ApiKeyId`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.Name, OLD.ServerId, OLD.ApiKeyId, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_GameServersDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_GameServersDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `GameServers`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `GameServersHistory` (`Id`, `Name`, `ServerId`, `ApiKeyId`, `Deleted`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.Name, OLD.ServerId, OLD.ApiKeyId, TRUE, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
ALTER TABLE `KnownUsers`
|
|
||||||
CHANGE `CreatedAt` `CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
ALTER TABLE `KnownUsers`
|
|
||||||
CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `KnownUsersHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`DiscordId` BIGINT(20) NOT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_KnownUsersUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_KnownUsersUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `KnownUsers`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `KnownUsersHistory` (`Id`, `DiscordId`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.KnownUserId, OLD.DiscordId, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_KnownUsersDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_KnownUsersDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `KnownUsers`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `KnownUsersHistory` (`Id`, `DiscordId`, `Deleted`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.KnownUserId, OLD.DiscordId, TRUE, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
ALTER TABLE `Levels`
|
|
||||||
CHANGE `CreatedAt` `CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
ALTER TABLE `Levels`
|
|
||||||
CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `LevelsHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`Name` VARCHAR(255) NOT NULL,
|
|
||||||
`Color` VARCHAR(8) NOT NULL,
|
|
||||||
`MinXp` BIGINT(20) NOT NULL,
|
|
||||||
`PermissionInt` BIGINT(20) NOT NULL,
|
|
||||||
`ServerId` BIGINT(20) DEFAULT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_LevelsUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_LevelsUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `Levels`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `LevelsHistory` (`Id`, `Name`, `Color`, `MinXp`, `PermissionInt`, `ServerId`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.Name, OLD.Color, OLD.MinXp, OLD.PermissionInt, OLD.ServerId, OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_LevelsDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_LevelsDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `Levels`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `LevelsHistory` (`Id`, `Name`, `Color`, `MinXp`, `PermissionInt`, `ServerId`, `Deleted`, `DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.Name, OLD.Color, OLD.MinXp, OLD.PermissionInt, OLD.ServerId, TRUE, OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
ALTER TABLE `Servers`
|
|
||||||
CHANGE `CreatedAt` `CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
ALTER TABLE `Servers`
|
|
||||||
CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `ServersHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`DiscordId` BIGINT(20) NOT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_ServersUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_ServersUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `Servers`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `ServersHistory` (`Id`, `DiscordId`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.ServerId, OLD.DiscordServerId, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_ServersDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_ServersDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `Servers`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `ServersHistory` (`Id`, `DiscordId`, `Deleted`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.ServerId, OLD.DiscordServerId, TRUE, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
ALTER TABLE `UserGameIdents`
|
|
||||||
CHANGE `CreatedAt` `CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
ALTER TABLE `UserGameIdents`
|
|
||||||
CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `UserGameIdentsHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`UserId` BIGINT(20) NOT NULL,
|
|
||||||
`GameServerId` BIGINT(20) NOT NULL,
|
|
||||||
`Ident` VARCHAR(255) NOT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_UserGameIdentsUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_UserGameIdentsUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `UserGameIdents`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `UserGameIdentsHistory` (`Id`, `UserId`, `GameServerId`, `Ident`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.UserId, OLD.GameServerId, OLD.Ident, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_UserGameIdentsDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_UserGameIdentsDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `UserGameIdents`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `UserGameIdentsHistory` (`Id`, `UserId`, `GameServerId`, `Ident`, `Deleted`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.UserId, OLD.GameServerId, OLD.Ident, TRUE, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
ALTER TABLE `UserJoinedGameServer`
|
|
||||||
CHANGE `CreatedAt` `CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
ALTER TABLE `UserJoinedGameServer`
|
|
||||||
CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `UserJoinedGameServerHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`UserId` BIGINT(20) NOT NULL,
|
|
||||||
`GameServerId` BIGINT(20) NOT NULL,
|
|
||||||
`JoinedOn` DATETIME(6) NOT NULL,
|
|
||||||
`LeavedOn` DATETIME(6) DEFAULT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_UserJoinedGameServerUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_UserJoinedGameServerUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `UserJoinedGameServer`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `UserJoinedGameServerHistory` (`Id`, `UserId`, `GameServerId`, `JoinedOn`, `LeavedOn`, `DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.UserId, OLD.GameServerId, OLD.JoinedOn, OLD.LeavedOn, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_UserJoinedGameServerDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_UserJoinedGameServerDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `UserJoinedGameServer`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `UserJoinedGameServerHistory` (`Id`, `UserId`, `GameServerId`, `JoinedOn`, `LeavedOn`, `Deleted`,
|
|
||||||
`DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.UserId, OLD.GameServerId, OLD.JoinedOn, OLD.LeavedOn, TRUE, OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
ALTER TABLE `UserJoinedServers`
|
|
||||||
CHANGE `CreatedAt` `CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
ALTER TABLE `UserJoinedServers`
|
|
||||||
CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `UserJoinedServersHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`UserId` BIGINT(20) NOT NULL,
|
|
||||||
`JoinedOn` DATETIME(6) NOT NULL,
|
|
||||||
`LeavedOn` DATETIME(6) DEFAULT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_UserJoinedServersUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_UserJoinedServersUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `UserJoinedServers`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `UserJoinedServersHistory` (`Id`, `UserId`, `JoinedOn`, `LeavedOn`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.JoinId, OLD.UserId, OLD.JoinedOn, OLD.LeavedOn, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_UserJoinedServersDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_UserJoinedServersDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `UserJoinedServers`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `UserJoinedServersHistory` (`Id`, `UserId`, `JoinedOn`, `LeavedOn`, `Deleted`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.JoinId, OLD.UserId, OLD.JoinedOn, OLD.LeavedOn, TRUE, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
ALTER TABLE `UserJoinedVoiceChannel`
|
|
||||||
CHANGE `CreatedAt` `CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
ALTER TABLE `UserJoinedVoiceChannel`
|
|
||||||
CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `UserJoinedVoiceChannelHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`UserId` BIGINT(20) NOT NULL,
|
|
||||||
`DiscordChannelId` BIGINT(20) NOT NULL,
|
|
||||||
`JoinedOn` DATETIME(6) NOT NULL,
|
|
||||||
`LeavedOn` DATETIME(6) DEFAULT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_UserJoinedVoiceChannelUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_UserJoinedVoiceChannelUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `UserJoinedVoiceChannel`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `UserJoinedVoiceChannelHistory` (`Id`, `UserId`, `DiscordChannelId`, `JoinedOn`, `LeavedOn`, `DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.JoinId, OLD.UserId, OLD.DiscordChannelId, OLD.JoinedOn, OLD.LeavedOn, OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_UserJoinedVoiceChannelDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_UserJoinedVoiceChannelDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `UserJoinedVoiceChannel`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `UserJoinedVoiceChannelHistory` (`Id`, `UserId`, `DiscordChannelId`, `JoinedOn`, `LeavedOn`, `Deleted`,
|
|
||||||
`DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.JoinId, OLD.UserId, OLD.DiscordChannelId, OLD.JoinedOn, OLD.LeavedOn, TRUE, OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
ALTER TABLE `UserMessageCountPerHour`
|
|
||||||
CHANGE `CreatedAt` `CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
ALTER TABLE `UserMessageCountPerHour`
|
|
||||||
CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `UserMessageCountPerHourHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`Date` DATETIME(6) NOT NULL,
|
|
||||||
`Hour` BIGINT(20) DEFAULT NULL,
|
|
||||||
`XPCount` BIGINT(20) DEFAULT NULL,
|
|
||||||
`UserId` BIGINT(20) DEFAULT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_UserMessageCountPerHourUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_UserMessageCountPerHourUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `UserMessageCountPerHour`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `UserMessageCountPerHourHistory` (`Id`, `UserId`, `Date`, `Hour`, `XPCount`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.UserId, OLD.Date, OLD.Hour, OLD.XPCount, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_UserMessageCountPerHourDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_UserMessageCountPerHourDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `UserMessageCountPerHour`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `UserMessageCountPerHourHistory` (`Id`, `UserId`, `Date`, `Hour`, `XPCount`, `Deleted`, `DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.UserId, OLD.Date, OLD.Hour, OLD.XPCount, TRUE, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
ALTER TABLE `Users`
|
|
||||||
CHANGE `CreatedAt` `CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
ALTER TABLE `Users`
|
|
||||||
CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `UsersHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`DiscordId` BIGINT(20) NOT NULL,
|
|
||||||
`XP` BIGINT(20) NOT NULL DEFAULT 0,
|
|
||||||
`ServerId` BIGINT(20) DEFAULT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_UsersUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_UsersUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `Users`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `UsersHistory` (`Id`, `DiscordId`, `XP`, `ServerId`,
|
|
||||||
`DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.UserId, OLD.DiscordId, OLD.XP, OLD.ServerId,
|
|
||||||
OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_UsersDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_UsersDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `Users`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `UsersHistory` (`Id`, `DiscordId`, `XP`, `ServerId`,
|
|
||||||
`Deleted`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.UserId, OLD.DiscordId, OLD.XP, OLD.ServerId, TRUE,
|
|
||||||
OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
ALTER TABLE `UserWarnings`
|
|
||||||
CHANGE `CreatedAt` `CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
ALTER TABLE `UserWarnings`
|
|
||||||
CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `UserWarningsHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`Description` VARCHAR(255) NOT NULL,
|
|
||||||
`UserId` BIGINT(20) NOT NULL,
|
|
||||||
`Author` BIGINT(20) DEFAULT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_UserWarningsUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_UserWarningsUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `UserWarnings`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `UserWarningsHistory` (`Id`, `Description`, `UserId`, `Author`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.Description, OLD.UserId, OLD.Author, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_UserWarningsDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_UserWarningsDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `UserWarnings`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `UserWarningsHistory` (`Id`, `Description`, `UserId`, `Author`, `Deleted`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.Description, OLD.UserId, OLD.Author, TRUE, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
@@ -1,10 +0,0 @@
|
|||||||
DROP TABLE `UserGotAchievements`;
|
|
||||||
|
|
||||||
DROP TABLE `Achievements`;
|
|
||||||
|
|
||||||
ALTER TABLE Users DROP COLUMN MessageCount;
|
|
||||||
|
|
||||||
ALTER TABLE Users DROP COLUMN ReactionCount;
|
|
||||||
|
|
||||||
DROP TABLE `AchievementsHistory`;
|
|
||||||
|
|
@@ -1,88 +0,0 @@
|
|||||||
CREATE TABLE IF NOT EXISTS `Achievements`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`Name` VARCHAR(255) NOT NULL,
|
|
||||||
`Description` VARCHAR(255) NOT NULL,
|
|
||||||
`Attribute` VARCHAR(255) NOT NULL,
|
|
||||||
`Operator` VARCHAR(255) NOT NULL,
|
|
||||||
`Value` VARCHAR(255) NOT NULL,
|
|
||||||
`ServerId` BIGINT,
|
|
||||||
`CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6),
|
|
||||||
`LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
|
||||||
PRIMARY KEY (`Id`),
|
|
||||||
FOREIGN KEY (`ServerId`) REFERENCES `Servers` (`ServerId`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `AchievementsHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`Name` VARCHAR(255) NOT NULL,
|
|
||||||
`Description` VARCHAR(255) NOT NULL,
|
|
||||||
`Attribute` VARCHAR(255) NOT NULL,
|
|
||||||
`Operator` VARCHAR(255) NOT NULL,
|
|
||||||
`Value` VARCHAR(255) NOT NULL,
|
|
||||||
`ServerId` BIGINT,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `UserGotAchievements`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`UserId` BIGINT,
|
|
||||||
`AchievementId` BIGINT,
|
|
||||||
`CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6),
|
|
||||||
`LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
|
||||||
PRIMARY KEY (`Id`),
|
|
||||||
FOREIGN KEY (`UserId`) REFERENCES `Users` (`UserId`),
|
|
||||||
FOREIGN KEY (`AchievementId`) REFERENCES `Achievements` (`Id`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE Users
|
|
||||||
ADD MessageCount BIGINT NOT NULL DEFAULT 0 AFTER XP;
|
|
||||||
|
|
||||||
ALTER TABLE Users
|
|
||||||
ADD ReactionCount BIGINT NOT NULL DEFAULT 0 AFTER XP;
|
|
||||||
|
|
||||||
ALTER TABLE UsersHistory
|
|
||||||
ADD MessageCount BIGINT NOT NULL DEFAULT 0 AFTER XP;
|
|
||||||
|
|
||||||
ALTER TABLE UsersHistory
|
|
||||||
ADD ReactionCount BIGINT NOT NULL DEFAULT 0 AFTER XP;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_AchievementsUpdate`;
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_AchievementsUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `Achievements`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `AchievementsHistory` (`Id`, `Name`, `Description`, `Attribute`, `Operator`, `Value`, `ServerId`,
|
|
||||||
`DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.Name, OLD.Description, OLD.Attribute, OLD.Operator, OLD.Value, OLD.ServerId, OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;
|
|
||||||
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_AchievementsDelete`;
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_AchievementsDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `Achievements`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `AchievementsHistory` (`Id`, `Name`, `Description`, `Attribute`, `Operator`, `Value`, `ServerId`,
|
|
||||||
`Deleted`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.Name, OLD.Description, OLD.Attribute, OLD.Operator, OLD.Value, OLD.ServerId, TRUE,
|
|
||||||
OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;
|
|
||||||
|
|
||||||
|
|
@@ -1,24 +0,0 @@
|
|||||||
DROP TABLE `CFG_ServerTeamRoleIds`;
|
|
||||||
|
|
||||||
DROP TABLE `CFG_ServerTeamRoleIdsHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `CFG_ServerAFKChannelIds`;
|
|
||||||
|
|
||||||
DROP TABLE `CFG_ServerAFKChannelIdsHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `CFG_Server`;
|
|
||||||
|
|
||||||
DROP TABLE `CFG_ServerHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `CFG_TechnicianPingUrls`;
|
|
||||||
|
|
||||||
DROP TABLE `CFG_TechnicianPingUrlsHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `CFG_TechnicianIds`;
|
|
||||||
|
|
||||||
DROP TABLE `CFG_TechnicianIdsHistory`;
|
|
||||||
|
|
||||||
DROP TABLE `CFG_Technician`;
|
|
||||||
|
|
||||||
DROP TABLE `CFG_TechnicianHistory`;
|
|
||||||
|
|
@@ -1,452 +0,0 @@
|
|||||||
CREATE TABLE IF NOT EXISTS `CFG_Server`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`MessageDeleteTimer` BIGINT NOT NULL DEFAULT 6,
|
|
||||||
`NotificationChatId` BIGINT NOT NULL,
|
|
||||||
`MaxVoiceStateHours` BIGINT NOT NULL DEFAULT 6,
|
|
||||||
`XpPerMessage` BIGINT NOT NULL DEFAULT 1,
|
|
||||||
`XpPerReaction` BIGINT NOT NULL DEFAULT 1,
|
|
||||||
`MaxMessageXpPerHour` BIGINT NOT NULL DEFAULT 20,
|
|
||||||
`XpPerOntimeHour` BIGINT NOT NULL DEFAULT 10,
|
|
||||||
`XpPerEventParticipation` BIGINT NOT NULL DEFAULT 10,
|
|
||||||
`XpPerAchievement` BIGINT NOT NULL DEFAULT 10,
|
|
||||||
`AFKCommandChannelId` BIGINT NOT NULL,
|
|
||||||
`HelpVoiceChannelId` BIGINT NOT NULL,
|
|
||||||
`TeamChannelId` BIGINT NOT NULL,
|
|
||||||
`LoginMessageChannelId` BIGINT NOT NULL,
|
|
||||||
`ServerId` BIGINT NOT NULL,
|
|
||||||
`CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6),
|
|
||||||
`LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
|
||||||
PRIMARY KEY (`Id`),
|
|
||||||
FOREIGN KEY (`ServerId`) REFERENCES `Servers` (`ServerId`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `CFG_ServerAFKChannelIds`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`ChannelId` BIGINT NOT NULL,
|
|
||||||
`ServerId` BIGINT NOT NULL,
|
|
||||||
`CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6),
|
|
||||||
`LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
|
||||||
PRIMARY KEY (`Id`),
|
|
||||||
FOREIGN KEY (`ServerId`) REFERENCES `Servers` (`ServerId`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `CFG_ServerTeamRoleIds`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`RoleId` BIGINT NOT NULL,
|
|
||||||
`TeamMemberType` ENUM ('Moderator', 'Admin') NOT NULL,
|
|
||||||
`ServerId` BIGINT NOT NULL,
|
|
||||||
`CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6),
|
|
||||||
`LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
|
||||||
PRIMARY KEY (`Id`),
|
|
||||||
FOREIGN KEY (`ServerId`) REFERENCES `Servers` (`ServerId`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `CFG_Technician`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`HelpCommandReferenceUrl` VARCHAR(255) NOT NULL,
|
|
||||||
`WaitForRestart` BIGINT NOT NULL DEFAULT 8,
|
|
||||||
`WaitForShutdown` BIGINT NOT NULL DEFAULT 8,
|
|
||||||
`CacheMaxMessages` BIGINT NOT NULL DEFAULT 1000000,
|
|
||||||
`CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6),
|
|
||||||
`LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
|
||||||
PRIMARY KEY (`Id`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `CFG_TechnicianPingUrls`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`URL` VARCHAR(255) NOT NULL,
|
|
||||||
`CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6),
|
|
||||||
`LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
|
||||||
PRIMARY KEY (`Id`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `CFG_TechnicianIds`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`TechnicianId` BIGINT NOT NULL,
|
|
||||||
`CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6),
|
|
||||||
`LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
|
||||||
PRIMARY KEY (`Id`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `CFG_ServerHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`MessageDeleteTimer` BIGINT NOT NULL DEFAULT 6,
|
|
||||||
`NotificationChatId` BIGINT NOT NULL,
|
|
||||||
`MaxVoiceStateHours` BIGINT NOT NULL DEFAULT 6,
|
|
||||||
`XpPerMessage` BIGINT NOT NULL DEFAULT 1,
|
|
||||||
`XpPerReaction` BIGINT NOT NULL DEFAULT 1,
|
|
||||||
`MaxMessageXpPerHour` BIGINT NOT NULL DEFAULT 20,
|
|
||||||
`XpPerOntimeHour` BIGINT NOT NULL DEFAULT 10,
|
|
||||||
`XpPerEventParticipation` BIGINT NOT NULL DEFAULT 10,
|
|
||||||
`XpPerAchievement` BIGINT NOT NULL DEFAULT 10,
|
|
||||||
`AFKCommandChannelId` BIGINT NOT NULL,
|
|
||||||
`HelpVoiceChannelId` BIGINT NOT NULL,
|
|
||||||
`TeamChannelId` BIGINT NOT NULL,
|
|
||||||
`LoginMessageChannelId` BIGINT NOT NULL,
|
|
||||||
`ServerId` BIGINT NOT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_ServerUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_ServerUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `CFG_Server`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_ServerHistory` (`Id`,
|
|
||||||
`MessageDeleteTimer`,
|
|
||||||
`NotificationChatId`,
|
|
||||||
`MaxVoiceStateHours`,
|
|
||||||
`XpPerMessage`,
|
|
||||||
`XpPerReaction`,
|
|
||||||
`MaxMessageXpPerHour`,
|
|
||||||
`XpPerOntimeHour`,
|
|
||||||
`XpPerEventParticipation`,
|
|
||||||
`XpPerAchievement`,
|
|
||||||
`AFKCommandChannelId`,
|
|
||||||
`HelpVoiceChannelId`,
|
|
||||||
`TeamChannelId`,
|
|
||||||
`LoginMessageChannelId`,
|
|
||||||
`ServerId`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.MessageDeleteTimer,
|
|
||||||
OLD.NotificationChatId,
|
|
||||||
OLD.MaxVoiceStateHours,
|
|
||||||
OLD.XpPerMessage,
|
|
||||||
OLD.XpPerReaction,
|
|
||||||
OLD.MaxMessageXpPerHour,
|
|
||||||
OLD.XpPerOntimeHour,
|
|
||||||
OLD.XpPerEventParticipation,
|
|
||||||
OLD.XpPerAchievement,
|
|
||||||
OLD.AFKCommandChannelId,
|
|
||||||
OLD.HelpVoiceChannelId,
|
|
||||||
OLD.TeamChannelId,
|
|
||||||
OLD.LoginMessageChannelId,
|
|
||||||
OLD.ServerId,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_ServerDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_ServerDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `CFG_Server`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_ServerHistory` (`Id`,
|
|
||||||
`MessageDeleteTimer`,
|
|
||||||
`NotificationChatId`,
|
|
||||||
`MaxVoiceStateHours`,
|
|
||||||
`XpPerMessage`,
|
|
||||||
`XpPerReaction`,
|
|
||||||
`MaxMessageXpPerHour`,
|
|
||||||
`XpPerOntimeHour`,
|
|
||||||
`XpPerEventParticipation`,
|
|
||||||
`XpPerAchievement`,
|
|
||||||
`AFKCommandChannelId`,
|
|
||||||
`HelpVoiceChannelId`,
|
|
||||||
`TeamChannelId`,
|
|
||||||
`LoginMessageChannelId`,
|
|
||||||
`ServerId`,
|
|
||||||
`Deleted`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.MessageDeleteTimer,
|
|
||||||
OLD.NotificationChatId,
|
|
||||||
OLD.MaxVoiceStateHours,
|
|
||||||
OLD.XpPerMessage,
|
|
||||||
OLD.XpPerReaction,
|
|
||||||
OLD.MaxMessageXpPerHour,
|
|
||||||
OLD.XpPerOntimeHour,
|
|
||||||
OLD.XpPerEventParticipation,
|
|
||||||
OLD.XpPerAchievement,
|
|
||||||
OLD.AFKCommandChannelId,
|
|
||||||
OLD.HelpVoiceChannelId,
|
|
||||||
OLD.TeamChannelId,
|
|
||||||
OLD.LoginMessageChannelId,
|
|
||||||
OLD.ServerId,
|
|
||||||
TRUE,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `CFG_ServerAFKChannelIdsHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`ChannelId` BIGINT NOT NULL,
|
|
||||||
`ServerId` BIGINT NOT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_ServerAFKChannelIdsUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_ServerAFKChannelIdsUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `CFG_ServerAFKChannelIds`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_ServerAFKChannelIdsHistory` (`Id`,
|
|
||||||
`ChannelId`,
|
|
||||||
`ServerId`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.ChannelId,
|
|
||||||
OLD.ServerId,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_ServerAFKChannelIdsDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_ServerAFKChannelIdsDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `CFG_ServerAFKChannelIds`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_ServerAFKChannelIdsHistory` (`Id`,
|
|
||||||
`ChannelId`,
|
|
||||||
`ServerId`,
|
|
||||||
`Deleted`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.ChannelId,
|
|
||||||
OLD.ServerId,
|
|
||||||
TRUE,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `CFG_ServerTeamRoleIdsHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`RoleId` BIGINT NOT NULL,
|
|
||||||
`TeamMemberType` ENUM ('Moderator', 'Admin') NOT NULL,
|
|
||||||
`ServerId` BIGINT NOT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_ServerTeamRoleIdsUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_ServerTeamRoleIdsUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `CFG_ServerTeamRoleIds`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_ServerTeamRoleIdsHistory` (`Id`,
|
|
||||||
`RoleId`,
|
|
||||||
`TeamMemberType`,
|
|
||||||
`ServerId`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.RoleId,
|
|
||||||
OLD.TeamMemberType,
|
|
||||||
OLD.ServerId,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_ServerTeamRoleIdsDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_ServerTeamRoleIdsDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `CFG_ServerTeamRoleIds`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_ServerTeamRoleIdsHistory` (`Id`,
|
|
||||||
`RoleId`,
|
|
||||||
`TeamMemberType`,
|
|
||||||
`ServerId`,
|
|
||||||
`Deleted`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.RoleId,
|
|
||||||
OLD.TeamMemberType,
|
|
||||||
OLD.ServerId,
|
|
||||||
TRUE,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `CFG_TechnicianHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`HelpCommandReferenceUrl` VARCHAR(255) NOT NULL,
|
|
||||||
`WaitForRestart` BIGINT NOT NULL DEFAULT 8,
|
|
||||||
`WaitForShutdown` BIGINT NOT NULL DEFAULT 8,
|
|
||||||
`CacheMaxMessages` BIGINT NOT NULL DEFAULT 1000000,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_TechnicianUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_TechnicianUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `CFG_Technician`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_TechnicianHistory` (`Id`,
|
|
||||||
`HelpCommandReferenceUrl`,
|
|
||||||
`WaitForRestart`,
|
|
||||||
`WaitForShutdown`,
|
|
||||||
`CacheMaxMessages`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.HelpCommandReferenceUrl,
|
|
||||||
OLD.WaitForRestart,
|
|
||||||
OLD.WaitForShutdown,
|
|
||||||
OLD.CacheMaxMessages,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_TechnicianDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_TechnicianDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `CFG_Technician`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_TechnicianHistory` (`Id`,
|
|
||||||
`HelpCommandReferenceUrl`,
|
|
||||||
`WaitForRestart`,
|
|
||||||
`WaitForShutdown`,
|
|
||||||
`CacheMaxMessages`,
|
|
||||||
`Deleted`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.HelpCommandReferenceUrl,
|
|
||||||
OLD.WaitForRestart,
|
|
||||||
OLD.WaitForShutdown,
|
|
||||||
OLD.CacheMaxMessages,
|
|
||||||
TRUE,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `CFG_TechnicianIdsHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`TechnicianId` BIGINT NOT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_TechnicianIdsUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_TechnicianIdsUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `CFG_TechnicianIds`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_TechnicianIdsHistory` (`Id`,
|
|
||||||
`TechnicianId`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.TechnicianId,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_TechnicianIdsDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_TechnicianIdsDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `CFG_TechnicianIds`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_TechnicianIdsHistory` (`Id`,
|
|
||||||
`TechnicianId`,
|
|
||||||
`Deleted`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.TechnicianId,
|
|
||||||
TRUE,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `CFG_TechnicianPingUrlsHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`URL` VARCHAR(255) NOT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_TechnicianPingUrlsUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_TechnicianPingUrlsUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `CFG_TechnicianPingUrls`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_TechnicianPingUrlsHistory` (`Id`,
|
|
||||||
`URL`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.URL,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_TechnicianPingUrlsDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_TechnicianPingUrlsDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `CFG_TechnicianPingUrls`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_TechnicianPingUrlsHistory` (`Id`,
|
|
||||||
`URL`,
|
|
||||||
`Deleted`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.URL,
|
|
||||||
TRUE,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
@@ -1,4 +0,0 @@
|
|||||||
ALTER TABLE CFG_Technician DROP COLUMN FeatureFlags;
|
|
||||||
|
|
||||||
ALTER TABLE CFG_Server DROP COLUMN FeatureFlags;
|
|
||||||
|
|
@@ -1,6 +0,0 @@
|
|||||||
ALTER TABLE CFG_Technician
|
|
||||||
ADD FeatureFlags JSON NULL DEFAULT ('{}') AFTER CacheMaxMessages;
|
|
||||||
|
|
||||||
ALTER TABLE CFG_Server
|
|
||||||
ADD FeatureFlags JSON NULL DEFAULT ('{}') AFTER LoginMessageChannelId;
|
|
||||||
|
|
@@ -1,4 +0,0 @@
|
|||||||
ALTER TABLE CFG_Server
|
|
||||||
DROP COLUMN DefaultRoleId;
|
|
||||||
|
|
||||||
|
|
@@ -1,4 +0,0 @@
|
|||||||
ALTER TABLE CFG_Server
|
|
||||||
ADD DefaultRoleId BIGINT NULL AFTER LoginMessageChannelId;
|
|
||||||
|
|
||||||
|
|
@@ -1,4 +0,0 @@
|
|||||||
DROP TABLE `ShortRoleNames`;
|
|
||||||
|
|
||||||
DROP TABLE `ShortRoleNamesHistory`;
|
|
||||||
|
|
@@ -1,53 +0,0 @@
|
|||||||
CREATE TABLE IF NOT EXISTS `ShortRoleNames`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`ShortName` VARCHAR(255) NOT NULL,
|
|
||||||
`DiscordRoleId` BIGINT NOT NULL,
|
|
||||||
`Position` ENUM ('before', 'after') NOT NULL,
|
|
||||||
`ServerId` BIGINT,
|
|
||||||
`CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6),
|
|
||||||
`LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
|
||||||
PRIMARY KEY (`Id`),
|
|
||||||
FOREIGN KEY (`ServerId`) REFERENCES `Servers` (`ServerId`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `ShortRoleNamesHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`ShortName` VARCHAR(64) DEFAULT NULL,
|
|
||||||
`DiscordRoleId` BIGINT(20) NOT NULL,
|
|
||||||
`Position` ENUM ('Before', 'After') NOT NULL,
|
|
||||||
`ServerId` BIGINT(20) DEFAULT NULL,
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_ShortRoleNamesUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_ShortRoleNamesUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `ShortRoleNames`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `ShortRoleNamesHistory` (`Id`, `ShortName`, `DiscordRoleId`, `Position`, `ServerId`, `DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.ShortName, OLD.DiscordRoleId, OLD.Position, OLD.ServerId, OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_ShortRoleNamesDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_ShortRoleNamesDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `ShortRoleNames`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `ShortRoleNamesHistory` (`Id`, `ShortName`, `DiscordRoleId`, `Position`, `ServerId`, `Deleted`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id, OLD.ShortName, OLD.DiscordRoleId, OLD.Position, OLD.ServerId, TRUE, OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
@@ -1,10 +0,0 @@
|
|||||||
ALTER TABLE CFG_ServerHistory
|
|
||||||
DROP COLUMN DefaultRoleId;
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE CFG_TechnicianHistory
|
|
||||||
DROP COLUMN FeatureFlags;
|
|
||||||
|
|
||||||
ALTER TABLE CFG_ServerHistory
|
|
||||||
DROP COLUMN FeatureFlags;
|
|
||||||
|
|
@@ -1,171 +0,0 @@
|
|||||||
ALTER TABLE CFG_ServerHistory
|
|
||||||
ADD DefaultRoleId BIGINT NULL AFTER LoginMessageChannelId;
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE CFG_TechnicianHistory
|
|
||||||
ADD FeatureFlags JSON NULL DEFAULT ('{}') AFTER CacheMaxMessages;
|
|
||||||
|
|
||||||
ALTER TABLE CFG_ServerHistory
|
|
||||||
ADD FeatureFlags JSON NULL DEFAULT ('{}') AFTER LoginMessageChannelId;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_ServerUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_ServerUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `CFG_Server`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_ServerHistory` (`Id`,
|
|
||||||
`MessageDeleteTimer`,
|
|
||||||
`NotificationChatId`,
|
|
||||||
`MaxVoiceStateHours`,
|
|
||||||
`XpPerMessage`,
|
|
||||||
`XpPerReaction`,
|
|
||||||
`MaxMessageXpPerHour`,
|
|
||||||
`XpPerOntimeHour`,
|
|
||||||
`XpPerEventParticipation`,
|
|
||||||
`XpPerAchievement`,
|
|
||||||
`AFKCommandChannelId`,
|
|
||||||
`HelpVoiceChannelId`,
|
|
||||||
`TeamChannelId`,
|
|
||||||
`LoginMessageChannelId`,
|
|
||||||
`DefaultRoleId`,
|
|
||||||
`FeatureFlags`,
|
|
||||||
`ServerId`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.MessageDeleteTimer,
|
|
||||||
OLD.NotificationChatId,
|
|
||||||
OLD.MaxVoiceStateHours,
|
|
||||||
OLD.XpPerMessage,
|
|
||||||
OLD.XpPerReaction,
|
|
||||||
OLD.MaxMessageXpPerHour,
|
|
||||||
OLD.XpPerOntimeHour,
|
|
||||||
OLD.XpPerEventParticipation,
|
|
||||||
OLD.XpPerAchievement,
|
|
||||||
OLD.AFKCommandChannelId,
|
|
||||||
OLD.HelpVoiceChannelId,
|
|
||||||
OLD.TeamChannelId,
|
|
||||||
OLD.LoginMessageChannelId,
|
|
||||||
OLD.DefaultRoleId,
|
|
||||||
OLD.FeatureFlags,
|
|
||||||
OLD.ServerId,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_ServerDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_ServerDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `CFG_Server`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_ServerHistory` (`Id`,
|
|
||||||
`MessageDeleteTimer`,
|
|
||||||
`NotificationChatId`,
|
|
||||||
`MaxVoiceStateHours`,
|
|
||||||
`XpPerMessage`,
|
|
||||||
`XpPerReaction`,
|
|
||||||
`MaxMessageXpPerHour`,
|
|
||||||
`XpPerOntimeHour`,
|
|
||||||
`XpPerEventParticipation`,
|
|
||||||
`XpPerAchievement`,
|
|
||||||
`AFKCommandChannelId`,
|
|
||||||
`HelpVoiceChannelId`,
|
|
||||||
`TeamChannelId`,
|
|
||||||
`LoginMessageChannelId`,
|
|
||||||
`DefaultRoleId`,
|
|
||||||
`ServerId`,
|
|
||||||
`FeatureFlags`,
|
|
||||||
`Deleted`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.MessageDeleteTimer,
|
|
||||||
OLD.NotificationChatId,
|
|
||||||
OLD.MaxVoiceStateHours,
|
|
||||||
OLD.XpPerMessage,
|
|
||||||
OLD.XpPerReaction,
|
|
||||||
OLD.MaxMessageXpPerHour,
|
|
||||||
OLD.XpPerOntimeHour,
|
|
||||||
OLD.XpPerEventParticipation,
|
|
||||||
OLD.XpPerAchievement,
|
|
||||||
OLD.AFKCommandChannelId,
|
|
||||||
OLD.HelpVoiceChannelId,
|
|
||||||
OLD.TeamChannelId,
|
|
||||||
OLD.LoginMessageChannelId,
|
|
||||||
OLD.DefaultRoleId,
|
|
||||||
OLD.FeatureFlags,
|
|
||||||
OLD.ServerId,
|
|
||||||
TRUE,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `CFG_TechnicianHistory`
|
|
||||||
(
|
|
||||||
`Id` BIGINT(20) NOT NULL,
|
|
||||||
`HelpCommandReferenceUrl` VARCHAR(255) NOT NULL,
|
|
||||||
`WaitForRestart` BIGINT NOT NULL DEFAULT 8,
|
|
||||||
`WaitForShutdown` BIGINT NOT NULL DEFAULT 8,
|
|
||||||
`CacheMaxMessages` BIGINT NOT NULL DEFAULT 1000000,
|
|
||||||
`FeatureFlags` JSON NULL DEFAULT ('{}'),
|
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
|
||||||
`DateTo` DATETIME(6) NOT NULL
|
|
||||||
);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_TechnicianUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_TechnicianUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `CFG_Technician`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_TechnicianHistory` (`Id`,
|
|
||||||
`HelpCommandReferenceUrl`,
|
|
||||||
`WaitForRestart`,
|
|
||||||
`WaitForShutdown`,
|
|
||||||
`CacheMaxMessages`,
|
|
||||||
`FeatureFlags`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.HelpCommandReferenceUrl,
|
|
||||||
OLD.WaitForRestart,
|
|
||||||
OLD.WaitForShutdown,
|
|
||||||
OLD.CacheMaxMessages,
|
|
||||||
OLD.FeatureFlags,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_TechnicianDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_TechnicianDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `CFG_Technician`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_TechnicianHistory` (`Id`,
|
|
||||||
`HelpCommandReferenceUrl`,
|
|
||||||
`WaitForRestart`,
|
|
||||||
`WaitForShutdown`,
|
|
||||||
`CacheMaxMessages`,
|
|
||||||
`FeatureFlags`,
|
|
||||||
`Deleted`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.HelpCommandReferenceUrl,
|
|
||||||
OLD.WaitForRestart,
|
|
||||||
OLD.WaitForShutdown,
|
|
||||||
OLD.CacheMaxMessages,
|
|
||||||
OLD.FeatureFlags,
|
|
||||||
TRUE,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
@@ -1,9 +0,0 @@
|
|||||||
ALTER TABLE CFG_Server
|
|
||||||
DROP COLUMN ShortRoleNameSetOnlyHighest;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE CFG_ServerHistory
|
|
||||||
DROP COLUMN ShortRoleNameSetOnlyHighest;
|
|
||||||
|
|
||||||
|
|
@@ -1,108 +0,0 @@
|
|||||||
ALTER TABLE CFG_Server
|
|
||||||
ADD ShortRoleNameSetOnlyHighest BOOLEAN NOT NULL DEFAULT FALSE AFTER DefaultRoleId;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE CFG_ServerHistory
|
|
||||||
ADD ShortRoleNameSetOnlyHighest BOOLEAN NOT NULL DEFAULT FALSE AFTER DefaultRoleId;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_ServerUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_ServerUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `CFG_Server`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_ServerHistory` (`Id`,
|
|
||||||
`MessageDeleteTimer`,
|
|
||||||
`NotificationChatId`,
|
|
||||||
`MaxVoiceStateHours`,
|
|
||||||
`XpPerMessage`,
|
|
||||||
`XpPerReaction`,
|
|
||||||
`MaxMessageXpPerHour`,
|
|
||||||
`XpPerOntimeHour`,
|
|
||||||
`XpPerEventParticipation`,
|
|
||||||
`XpPerAchievement`,
|
|
||||||
`AFKCommandChannelId`,
|
|
||||||
`HelpVoiceChannelId`,
|
|
||||||
`TeamChannelId`,
|
|
||||||
`LoginMessageChannelId`,
|
|
||||||
`DefaultRoleId`,
|
|
||||||
`ShortRoleNameSetOnlyHighest`,
|
|
||||||
`FeatureFlags`,
|
|
||||||
`ServerId`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.MessageDeleteTimer,
|
|
||||||
OLD.NotificationChatId,
|
|
||||||
OLD.MaxVoiceStateHours,
|
|
||||||
OLD.XpPerMessage,
|
|
||||||
OLD.XpPerReaction,
|
|
||||||
OLD.MaxMessageXpPerHour,
|
|
||||||
OLD.XpPerOntimeHour,
|
|
||||||
OLD.XpPerEventParticipation,
|
|
||||||
OLD.XpPerAchievement,
|
|
||||||
OLD.AFKCommandChannelId,
|
|
||||||
OLD.HelpVoiceChannelId,
|
|
||||||
OLD.TeamChannelId,
|
|
||||||
OLD.LoginMessageChannelId,
|
|
||||||
OLD.DefaultRoleId,
|
|
||||||
OLD.ShortRoleNameSetOnlyHighest,
|
|
||||||
OLD.FeatureFlags,
|
|
||||||
OLD.ServerId,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_ServerDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_ServerDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `CFG_Server`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_ServerHistory` (`Id`,
|
|
||||||
`MessageDeleteTimer`,
|
|
||||||
`NotificationChatId`,
|
|
||||||
`MaxVoiceStateHours`,
|
|
||||||
`XpPerMessage`,
|
|
||||||
`XpPerReaction`,
|
|
||||||
`MaxMessageXpPerHour`,
|
|
||||||
`XpPerOntimeHour`,
|
|
||||||
`XpPerEventParticipation`,
|
|
||||||
`XpPerAchievement`,
|
|
||||||
`AFKCommandChannelId`,
|
|
||||||
`HelpVoiceChannelId`,
|
|
||||||
`TeamChannelId`,
|
|
||||||
`LoginMessageChannelId`,
|
|
||||||
`DefaultRoleId`,
|
|
||||||
`ShortRoleNameSetOnlyHighest`,
|
|
||||||
`ServerId`,
|
|
||||||
`FeatureFlags`,
|
|
||||||
`Deleted`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.MessageDeleteTimer,
|
|
||||||
OLD.NotificationChatId,
|
|
||||||
OLD.MaxVoiceStateHours,
|
|
||||||
OLD.XpPerMessage,
|
|
||||||
OLD.XpPerReaction,
|
|
||||||
OLD.MaxMessageXpPerHour,
|
|
||||||
OLD.XpPerOntimeHour,
|
|
||||||
OLD.XpPerEventParticipation,
|
|
||||||
OLD.XpPerAchievement,
|
|
||||||
OLD.AFKCommandChannelId,
|
|
||||||
OLD.HelpVoiceChannelId,
|
|
||||||
OLD.TeamChannelId,
|
|
||||||
OLD.LoginMessageChannelId,
|
|
||||||
OLD.DefaultRoleId,
|
|
||||||
OLD.ShortRoleNameSetOnlyHighest,
|
|
||||||
OLD.FeatureFlags,
|
|
||||||
OLD.ServerId,
|
|
||||||
TRUE,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
@@ -1,9 +0,0 @@
|
|||||||
ALTER TABLE UsersHistory
|
|
||||||
DROP COLUMN MessageCount;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE UsersHistory
|
|
||||||
DROP COLUMN ReactionCount;
|
|
||||||
|
|
||||||
|
|
@@ -1,32 +0,0 @@
|
|||||||
ALTER TABLE `Users`
|
|
||||||
CHANGE `CreatedAt` `CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
ALTER TABLE `Users`
|
|
||||||
CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_UsersUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_UsersUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `Users`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `UsersHistory` (`Id`, `DiscordId`, `XP`, `ReactionCount`, `MessageCount`, `ServerId`,
|
|
||||||
`DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.UserId, OLD.DiscordId, OLD.XP, OLD.ReactionCount, OLD.MessageCount, OLD.ServerId,
|
|
||||||
OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_UsersDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_UsersDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `Users`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `UsersHistory` (`Id`, `DiscordId`, `XP`, `ReactionCount`, `MessageCount`, `ServerId`,
|
|
||||||
`Deleted`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.UserId, OLD.DiscordId, OLD.XP, OLD.ReactionCount, OLD.MessageCount, OLD.ServerId, TRUE,
|
|
||||||
OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
@@ -1,19 +0,0 @@
|
|||||||
ALTER TABLE Users
|
|
||||||
DROP COLUMN Birthday;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE UsersHistory
|
|
||||||
DROP COLUMN Birthday;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE CFG_Server
|
|
||||||
DROP COLUMN XpForBirthday;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE CFG_ServerHistory
|
|
||||||
DROP COLUMN XpForBirthday;
|
|
||||||
|
|
||||||
|
|
@@ -1,150 +0,0 @@
|
|||||||
ALTER TABLE Users
|
|
||||||
ADD Birthday DATE NULL AFTER MessageCount;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE UsersHistory
|
|
||||||
ADD Birthday DATE NULL AFTER MessageCount;
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE `Users`
|
|
||||||
CHANGE `CreatedAt` `CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
ALTER TABLE `Users`
|
|
||||||
CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_UsersUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_UsersUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `Users`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `UsersHistory` (`Id`, `DiscordId`, `XP`, `ReactionCount`, `MessageCount`, `Birthday`, `ServerId`,
|
|
||||||
`DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.UserId, OLD.DiscordId, OLD.XP, OLD.ReactionCount, OLD.MessageCount, OLD.Birthday, OLD.ServerId,
|
|
||||||
OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_UsersDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_UsersDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `Users`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `UsersHistory` (`Id`, `DiscordId`, `XP`, `ReactionCount`, `MessageCount`, `Birthday`, `ServerId`,
|
|
||||||
`Deleted`, `DateFrom`, `DateTo`)
|
|
||||||
VALUES (OLD.UserId, OLD.DiscordId, OLD.XP, OLD.ReactionCount, OLD.MessageCount, OLD.Birthday, OLD.ServerId, TRUE,
|
|
||||||
OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE CFG_Server
|
|
||||||
ADD XpForBirthday BIGINT(20) NOT NULL DEFAULT 0 AFTER XpPerAchievement;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE CFG_ServerHistory
|
|
||||||
ADD XpForBirthday BIGINT(20) NOT NULL DEFAULT 0 AFTER XpPerAchievement;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_ServerUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_ServerUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `CFG_Server`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_ServerHistory` (`Id`,
|
|
||||||
`MessageDeleteTimer`,
|
|
||||||
`NotificationChatId`,
|
|
||||||
`MaxVoiceStateHours`,
|
|
||||||
`XpPerMessage`,
|
|
||||||
`XpPerReaction`,
|
|
||||||
`MaxMessageXpPerHour`,
|
|
||||||
`XpPerOntimeHour`,
|
|
||||||
`XpPerEventParticipation`,
|
|
||||||
`XpPerAchievement`,
|
|
||||||
`AFKCommandChannelId`,
|
|
||||||
`HelpVoiceChannelId`,
|
|
||||||
`TeamChannelId`,
|
|
||||||
`LoginMessageChannelId`,
|
|
||||||
`DefaultRoleId`,
|
|
||||||
`ShortRoleNameSetOnlyHighest`,
|
|
||||||
`FeatureFlags`,
|
|
||||||
`ServerId`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.MessageDeleteTimer,
|
|
||||||
OLD.NotificationChatId,
|
|
||||||
OLD.MaxVoiceStateHours,
|
|
||||||
OLD.XpPerMessage,
|
|
||||||
OLD.XpPerReaction,
|
|
||||||
OLD.MaxMessageXpPerHour,
|
|
||||||
OLD.XpPerOntimeHour,
|
|
||||||
OLD.XpPerEventParticipation,
|
|
||||||
OLD.XpPerAchievement,
|
|
||||||
OLD.AFKCommandChannelId,
|
|
||||||
OLD.HelpVoiceChannelId,
|
|
||||||
OLD.TeamChannelId,
|
|
||||||
OLD.LoginMessageChannelId,
|
|
||||||
OLD.DefaultRoleId,
|
|
||||||
OLD.ShortRoleNameSetOnlyHighest,
|
|
||||||
OLD.FeatureFlags,
|
|
||||||
OLD.ServerId,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_ServerDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_ServerDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `CFG_Server`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_ServerHistory` (`Id`,
|
|
||||||
`MessageDeleteTimer`,
|
|
||||||
`NotificationChatId`,
|
|
||||||
`MaxVoiceStateHours`,
|
|
||||||
`XpPerMessage`,
|
|
||||||
`XpPerReaction`,
|
|
||||||
`MaxMessageXpPerHour`,
|
|
||||||
`XpPerOntimeHour`,
|
|
||||||
`XpPerEventParticipation`,
|
|
||||||
`XpPerAchievement`,
|
|
||||||
`AFKCommandChannelId`,
|
|
||||||
`HelpVoiceChannelId`,
|
|
||||||
`TeamChannelId`,
|
|
||||||
`LoginMessageChannelId`,
|
|
||||||
`DefaultRoleId`,
|
|
||||||
`ShortRoleNameSetOnlyHighest`,
|
|
||||||
`ServerId`,
|
|
||||||
`FeatureFlags`,
|
|
||||||
`Deleted`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.MessageDeleteTimer,
|
|
||||||
OLD.NotificationChatId,
|
|
||||||
OLD.MaxVoiceStateHours,
|
|
||||||
OLD.XpPerMessage,
|
|
||||||
OLD.XpPerReaction,
|
|
||||||
OLD.MaxMessageXpPerHour,
|
|
||||||
OLD.XpPerOntimeHour,
|
|
||||||
OLD.XpPerEventParticipation,
|
|
||||||
OLD.XpPerAchievement,
|
|
||||||
OLD.AFKCommandChannelId,
|
|
||||||
OLD.HelpVoiceChannelId,
|
|
||||||
OLD.TeamChannelId,
|
|
||||||
OLD.LoginMessageChannelId,
|
|
||||||
OLD.DefaultRoleId,
|
|
||||||
OLD.ShortRoleNameSetOnlyHighest,
|
|
||||||
OLD.FeatureFlags,
|
|
||||||
OLD.ServerId,
|
|
||||||
TRUE,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
@@ -1,11 +0,0 @@
|
|||||||
DROP TABLE `SteamSpecialOffers`;
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE CFG_Server
|
|
||||||
DROP COLUMN GameOfferNotificationChatId;
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE CFG_ServerHistory
|
|
||||||
DROP COLUMN GameOfferNotificationChatId;
|
|
||||||
|
|
||||||
|
|
@@ -1,23 +0,0 @@
|
|||||||
CREATE TABLE IF NOT EXISTS `SteamSpecialOffers`
|
|
||||||
(
|
|
||||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
|
||||||
`Game` VARCHAR(255) NOT NULL,
|
|
||||||
`OriginalPrice` FLOAT NOT NULL,
|
|
||||||
`DiscountPrice` FLOAT NOT NULL,
|
|
||||||
`DiscountPct` BIGINT NOT NULL,
|
|
||||||
`CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6),
|
|
||||||
`LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
|
||||||
PRIMARY KEY (`Id`)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE CFG_Server
|
|
||||||
ADD COLUMN GameOfferNotificationChatId BIGINT NULL AFTER ShortRoleNameSetOnlyHighest;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE CFG_ServerHistory
|
|
||||||
ADD COLUMN GameOfferNotificationChatId BIGINT NULL AFTER ShortRoleNameSetOnlyHighest;
|
|
||||||
|
|
||||||
|
|
@@ -1,9 +0,0 @@
|
|||||||
ALTER TABLE CFG_Technician
|
|
||||||
DROP COLUMN MaxSteamOfferCount;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE CFG_TechnicianHistory
|
|
||||||
DROP COLUMN MaxSteamOfferCount;
|
|
||||||
|
|
||||||
|
|
@@ -1,64 +0,0 @@
|
|||||||
ALTER TABLE CFG_Technician
|
|
||||||
ADD MaxSteamOfferCount BIGINT NOT NULL DEFAULT 250 AFTER CacheMaxMessages;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE CFG_TechnicianHistory
|
|
||||||
ADD MaxSteamOfferCount BIGINT NOT NULL DEFAULT 250 AFTER CacheMaxMessages;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_TechnicianUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_TechnicianUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `CFG_Technician`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_TechnicianHistory` (`Id`,
|
|
||||||
`HelpCommandReferenceUrl`,
|
|
||||||
`WaitForRestart`,
|
|
||||||
`WaitForShutdown`,
|
|
||||||
`CacheMaxMessages`,
|
|
||||||
`MaxSteamOfferCount`,
|
|
||||||
`FeatureFlags`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.HelpCommandReferenceUrl,
|
|
||||||
OLD.WaitForRestart,
|
|
||||||
OLD.WaitForShutdown,
|
|
||||||
OLD.CacheMaxMessages,
|
|
||||||
OLD.MaxSteamOfferCount,
|
|
||||||
OLD.FeatureFlags,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_TechnicianDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_TechnicianDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `CFG_Technician`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_TechnicianHistory` (`Id`,
|
|
||||||
`HelpCommandReferenceUrl`,
|
|
||||||
`WaitForRestart`,
|
|
||||||
`WaitForShutdown`,
|
|
||||||
`CacheMaxMessages`,
|
|
||||||
`MaxSteamOfferCount`,
|
|
||||||
`FeatureFlags`,
|
|
||||||
`Deleted`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.HelpCommandReferenceUrl,
|
|
||||||
OLD.WaitForRestart,
|
|
||||||
OLD.WaitForShutdown,
|
|
||||||
OLD.CacheMaxMessages,
|
|
||||||
OLD.MaxSteamOfferCount,
|
|
||||||
OLD.FeatureFlags,
|
|
||||||
TRUE,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
@@ -1,9 +0,0 @@
|
|||||||
ALTER TABLE CFG_Technician
|
|
||||||
DROP COLUMN Maintenance;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE CFG_TechnicianHistory
|
|
||||||
DROP COLUMN Maintenance;
|
|
||||||
|
|
||||||
|
|
@@ -1,66 +0,0 @@
|
|||||||
ALTER TABLE CFG_Technician
|
|
||||||
ADD Maintenance BOOLEAN DEFAULT FALSE AFTER MaxSteamOfferCount;
|
|
||||||
|
|
||||||
ALTER TABLE CFG_TechnicianHistory
|
|
||||||
ADD Maintenance BOOLEAN DEFAULT FALSE AFTER MaxSteamOfferCount;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_TechnicianUpdate`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_TechnicianUpdate`
|
|
||||||
AFTER UPDATE
|
|
||||||
ON `CFG_Technician`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_TechnicianHistory` (`Id`,
|
|
||||||
`HelpCommandReferenceUrl`,
|
|
||||||
`WaitForRestart`,
|
|
||||||
`WaitForShutdown`,
|
|
||||||
`CacheMaxMessages`,
|
|
||||||
`MaxSteamOfferCount`,
|
|
||||||
`Maintenance`,
|
|
||||||
`FeatureFlags`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.HelpCommandReferenceUrl,
|
|
||||||
OLD.WaitForRestart,
|
|
||||||
OLD.WaitForShutdown,
|
|
||||||
OLD.CacheMaxMessages,
|
|
||||||
OLD.MaxSteamOfferCount,
|
|
||||||
OLD.Maintenance,
|
|
||||||
OLD.FeatureFlags,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
||||||
DROP TRIGGER IF EXISTS `TR_CFG_TechnicianDelete`;;
|
|
||||||
|
|
||||||
CREATE TRIGGER `TR_CFG_TechnicianDelete`
|
|
||||||
AFTER DELETE
|
|
||||||
ON `CFG_Technician`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO `CFG_TechnicianHistory` (`Id`,
|
|
||||||
`HelpCommandReferenceUrl`,
|
|
||||||
`WaitForRestart`,
|
|
||||||
`WaitForShutdown`,
|
|
||||||
`CacheMaxMessages`,
|
|
||||||
`MaxSteamOfferCount`,
|
|
||||||
`Maintenance`,
|
|
||||||
`FeatureFlags`,
|
|
||||||
`Deleted`,
|
|
||||||
`DateFrom`,
|
|
||||||
`DateTo`)
|
|
||||||
VALUES (OLD.Id,
|
|
||||||
OLD.HelpCommandReferenceUrl,
|
|
||||||
OLD.WaitForRestart,
|
|
||||||
OLD.WaitForShutdown,
|
|
||||||
OLD.CacheMaxMessages,
|
|
||||||
OLD.MaxSteamOfferCount,
|
|
||||||
OLD.Maintenance,
|
|
||||||
OLD.FeatureFlags,
|
|
||||||
TRUE,
|
|
||||||
OLD.LastModifiedAt,
|
|
||||||
CURRENT_TIMESTAMP(6));
|
|
||||||
END;;
|
|
||||||
|
|
@@ -1,3 +0,0 @@
|
|||||||
DROP TABLE `ShortRoleNames`;
|
|
||||||
|
|
||||||
DROP TABLE `ShortRoleNamesHistory`;
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user