Removed statistic module #190 #213

Merged
edraft merged 2 commits from #190 into 1.0.0 2023-02-20 14:17:52 +01:00
7 changed files with 64 additions and 29 deletions
Showing only changes of commit 16b2deec6b - Show all commits

View File

@ -13,7 +13,6 @@
"database": "src/modules/database/database.json",
"level": "src/modules/level/level.json",
"permission": "src/modules/permission/permission.json",
"stats": "src/modules/stats/stats.json",
"technician": "src/modules/technician/technician.json",
"get-version": "tools/get_version/get-version.json",
"post-build": "tools/post_build/post-build.json",

View File

@ -19,7 +19,7 @@
"cpl-core==2022.12.1.post3",
"cpl-translation==2022.12.1",
"cpl-query==2022.12.2.post1",
"Flask==2.2.3",
"Flask==2.2.2",
Ebola-Chan marked this conversation as resolved Outdated

Revert pls

Dennoch stats aus ProjectReferences entfernern
Ebenso aus workspace.json entfernen

Revert pls Dennoch stats aus ProjectReferences entfernern Ebenso aus workspace.json entfernen
  • bot.json reverted
  • Stats aus den Projectreferenzen entfernt
  • Stats aus den Projekten entfernt
  • Stats aus den FeatureFlagsEnum entfernt
  • Stats aus den FeatueFlagsSettings entfernt
* bot.json reverted * Stats aus den Projectreferenzen entfernt * Stats aus den Projekten entfernt * Stats aus den FeatureFlagsEnum entfernt * Stats aus den FeatueFlagsSettings entfernt
"Flask-Classful==0.14.2",
"Flask-Cors==3.0.10",
"PyJWT==2.6.0",
@ -41,15 +41,15 @@
"BuildSettings": {
"ProjectType": "console",
"SourcePath": "",
"OutputPath": "..\\..\\dist",
"OutputPath": "../../dist",
"Main": "bot.main",
"EntryPoint": "bot",
"IncludePackageData": false,
"Included": [],
"Excluded": [
"*\\__pycache__",
"*\\logs",
"*\\tests"
"*/__pycache__",
"*/logs",
"*/tests"
],
"PackageData": {},
"ProjectReferences": [
@ -63,7 +63,6 @@
"../modules/database/database.json",
"../modules/level/level.json",
"../modules/permission/permission.json",
"../modules/stats/stats.json",
"../modules/technician/technician.json"
]
}

View File

@ -10,6 +10,7 @@ from bot_data.migration.auto_role_fix1_migration import AutoRoleFix1Migration
from bot_data.migration.auto_role_migration import AutoRoleMigration
from bot_data.migration.initial_migration import InitialMigration
from bot_data.migration.level_migration import LevelMigration
from bot_data.migration.remove_stats_migration import RemoveStatsMigration
from bot_data.migration.stats_migration import StatsMigration
from bot_data.migration.user_joined_game_server_migration import UserJoinedGameServerMigration
from bot_data.migration.user_message_count_per_hour_migration import (
@ -36,3 +37,4 @@ class StartupMigrationExtension(StartupExtensionABC):
services.add_transient(MigrationABC, UserMessageCountPerHourMigration) # 11.01.2023 #168 - 0.3.1
services.add_transient(MigrationABC, ApiKeyMigration) # 09.02.2023 #162 - 1.0.0
services.add_transient(MigrationABC, UserJoinedGameServerMigration) # 12.02.2023 #181 - 1.0.0
services.add_transient(MigrationABC, RemoveStatsMigration) # 19.02.2023 #190 - 1.0.0

View File

@ -15,7 +15,6 @@ class FeatureFlagsEnum(Enum):
level_module = "LevelModule"
moderator_module = "ModeratorModule"
permission_module = "PermissionModule"
stats_module = "StatsModule"
# features
api_only = "ApiOnly"
presence = "Presence"

View File

@ -24,7 +24,6 @@ class FeatureFlagsSettings(ConfigurationModelABC):
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.stats_module.value: True, # 08.11.2022 #46
# features
FeatureFlagsEnum.api_only.value: False, # 13.10.2022 #70
FeatureFlagsEnum.presence.value: True, # 03.10.2022 #56

View File

@ -0,0 +1,43 @@
from bot_core.logging.database_logger import DatabaseLogger
from bot_data.abc.migration_abc import MigrationABC
from bot_data.db_context import DBContext
class RemoveStatsMigration(MigrationABC):
name = "1.0_RemoveStatsMigration"
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"""
DROP TABLE IF EXISTS `Statistics`;
"""
)
)
def downgrade(self):
self._cursor.execute(
str(
f"""
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`)
);
"""
)
)

View File

@ -4,7 +4,7 @@ from bot_data.db_context import DBContext
class StatsMigration(MigrationABC):
name = "1.0_RemoveStatsMigration"
name = "0.3_StatsMigration"
Ebola-Chan marked this conversation as resolved Outdated

Bitte in neue bzw. seperate Migration packen

Bitte in neue bzw. seperate Migration packen
  • stats_migration.py reverted
  • seperate Migration "remove_stats_migration.py" angelegt und Änderungen in die Datei verschoben
  • Neue Migration in in die "startup_migration_extension.py" hinzugefügt.
* stats_migration.py reverted * seperate Migration "remove_stats_migration.py" angelegt und Änderungen in die Datei verschoben * Neue Migration in in die "startup_migration_extension.py" hinzugefügt.
def __init__(self, logger: DatabaseLogger, db: DBContext):
MigrationABC.__init__(self)
@ -18,26 +18,20 @@ class StatsMigration(MigrationABC):
self._cursor.execute(
str(
f"""
DROP TABLE IF EXISTS `Statistics`;
"""
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`)
);
"""
)
)
def downgrade(self):
self._cursor.execute(
str(
f"""
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`)
);
"""
)
)
self._cursor.execute("DROP TABLE `Statistics`;")