From aec7dac4c7e707c9dda139ceb965983965f2a747 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Fri, 10 Nov 2023 13:22:36 +0100 Subject: [PATCH] Added 0.2.2 migration scripts #428 --- .../bot_data/migration/auto_role_migration.py | 2 +- .../bot_data/scripts/0.2.2/AutoRole_down.sql | 4 ++++ .../bot_data/scripts/0.2.2/AutoRole_up.sql | 24 +++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 bot/src/bot_data/scripts/0.2.2/AutoRole_down.sql create mode 100644 bot/src/bot_data/scripts/0.2.2/AutoRole_up.sql diff --git a/bot/src/bot_data/migration/auto_role_migration.py b/bot/src/bot_data/migration/auto_role_migration.py index 4b8e0090..b911e656 100644 --- a/bot/src/bot_data/migration/auto_role_migration.py +++ b/bot/src/bot_data/migration/auto_role_migration.py @@ -4,7 +4,7 @@ from bot_data.db_context import DBContext class AutoRoleMigration(MigrationABC): - name = "0.2.1_AutoRoleMigration" + name = "0.2.2_AutoRoleMigration" def __init__(self, logger: DatabaseLogger, db: DBContext): MigrationABC.__init__(self) diff --git a/bot/src/bot_data/scripts/0.2.2/AutoRole_down.sql b/bot/src/bot_data/scripts/0.2.2/AutoRole_down.sql new file mode 100644 index 00000000..c211f43c --- /dev/null +++ b/bot/src/bot_data/scripts/0.2.2/AutoRole_down.sql @@ -0,0 +1,4 @@ +DROP TABLE `AutoRoles`; + +DROP TABLE `AutoRoleRules`; + diff --git a/bot/src/bot_data/scripts/0.2.2/AutoRole_up.sql b/bot/src/bot_data/scripts/0.2.2/AutoRole_up.sql new file mode 100644 index 00000000..4f132be9 --- /dev/null +++ b/bot/src/bot_data/scripts/0.2.2/AutoRole_up.sql @@ -0,0 +1,24 @@ +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`) +); + +