Added 0.2.2 migration scripts #428

This commit is contained in:
Sven Heidemann 2023-11-10 13:22:36 +01:00
parent 407ec08463
commit aec7dac4c7
3 changed files with 29 additions and 1 deletions

View File

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

View File

@ -0,0 +1,4 @@
DROP TABLE `AutoRoles`;
DROP TABLE `AutoRoleRules`;

View File

@ -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`)
);