Added other scripts #428
This commit is contained in:
parent
35a8b8f592
commit
4e12ba5ffe
6
bot/src/bot_data/scripts/1.1.0/1_Achievements_down.sql
Normal file
6
bot/src/bot_data/scripts/1.1.0/1_Achievements_down.sql
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
DROP TABLE `Achievements`;
|
||||||
|
|
||||||
|
ALTER TABLE Users DROP COLUMN MessageCount;
|
||||||
|
|
||||||
|
ALTER TABLE Users DROP COLUMN ReactionCount;
|
||||||
|
|
88
bot/src/bot_data/scripts/1.1.0/1_Achievements_up.sql
Normal file
88
bot/src/bot_data/scripts/1.1.0/1_Achievements_up.sql
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
|
8
bot/src/bot_data/scripts/1.1.0/2_Config_down.sql
Normal file
8
bot/src/bot_data/scripts/1.1.0/2_Config_down.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
DROP TABLE `CFG_Server`;
|
||||||
|
|
||||||
|
DROP TABLE `CFG_Technician`;
|
||||||
|
|
||||||
|
DROP TABLE `CFG_TechnicianPingUrls`;
|
||||||
|
|
||||||
|
DROP TABLE `CFG_TechnicianIds`;
|
||||||
|
|
482
bot/src/bot_data/scripts/1.1.0/2_Config_up.sql
Normal file
482
bot/src/bot_data/scripts/1.1.0/2_Config_up.sql
Normal file
@ -0,0 +1,482 @@
|
|||||||
|
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,
|
||||||
|
`DefaultRoleId` BIGINT NULL,
|
||||||
|
`ShortRoleNameSetOnlyHighest` BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
|
`FeatureFlags` JSON NULL DEFAULT ('{}'),
|
||||||
|
`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`,
|
||||||
|
`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;;
|
||||||
|
|
||||||
|
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,
|
||||||
|
`MaxSteamOfferCount` BIGINT NOT NULL DEFAULT 250,
|
||||||
|
`Maintenance` BOOLEAN DEFAULT FALSE,
|
||||||
|
`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`,
|
||||||
|
`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;;
|
||||||
|
|
||||||
|
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;;
|
||||||
|
|
@ -0,0 +1,4 @@
|
|||||||
|
ALTER TABLE CFG_Technician DROP COLUMN FeatureFlags;
|
||||||
|
|
||||||
|
ALTER TABLE CFG_Server DROP COLUMN FeatureFlags;
|
||||||
|
|
@ -0,0 +1,6 @@
|
|||||||
|
ALTER TABLE CFG_Technician
|
||||||
|
ADD FeatureFlags JSON NULL DEFAULT ('{}') AFTER CacheMaxMessages;
|
||||||
|
|
||||||
|
ALTER TABLE CFG_Server
|
||||||
|
ADD FeatureFlags JSON NULL DEFAULT ('{}') AFTER LoginMessageChannelId;
|
||||||
|
|
4
bot/src/bot_data/scripts/1.1.3/1_DefaultRole_down.sql
Normal file
4
bot/src/bot_data/scripts/1.1.3/1_DefaultRole_down.sql
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
ALTER TABLE CFG_Server
|
||||||
|
DROP COLUMN DefaultRoleId;
|
||||||
|
|
||||||
|
|
4
bot/src/bot_data/scripts/1.1.3/1_DefaultRole_up.sql
Normal file
4
bot/src/bot_data/scripts/1.1.3/1_DefaultRole_up.sql
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
ALTER TABLE CFG_Server
|
||||||
|
ADD DefaultRoleId BIGINT NULL AFTER LoginMessageChannelId;
|
||||||
|
|
||||||
|
|
4
bot/src/bot_data/scripts/1.1.7/1_ShortRoleName_down.sql
Normal file
4
bot/src/bot_data/scripts/1.1.7/1_ShortRoleName_down.sql
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
DROP TABLE `ShortRoleNames`;
|
||||||
|
|
||||||
|
DROP TABLE `ShortRoleNamesHistory`;
|
||||||
|
|
53
bot/src/bot_data/scripts/1.1.7/1_ShortRoleName_up.sql
Normal file
53
bot/src/bot_data/scripts/1.1.7/1_ShortRoleName_up.sql
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
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;;
|
||||||
|
|
10
bot/src/bot_data/scripts/1.1.7/2_FixUpdates_down.sql
Normal file
10
bot/src/bot_data/scripts/1.1.7/2_FixUpdates_down.sql
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
ALTER TABLE CFG_ServerHistory
|
||||||
|
DROP COLUMN DefaultRoleId;
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE CFG_TechnicianHistory
|
||||||
|
DROP COLUMN FeatureFlags;
|
||||||
|
|
||||||
|
ALTER TABLE CFG_ServerHistory
|
||||||
|
DROP COLUMN FeatureFlags;
|
||||||
|
|
210
bot/src/bot_data/scripts/1.1.7/2_FixUpdates_up.sql
Normal file
210
bot/src/bot_data/scripts/1.1.7/2_FixUpdates_up.sql
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
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,
|
||||||
|
`DefaultRoleId` BIGINT NULL,
|
||||||
|
`ShortRoleNameSetOnlyHighest` BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
|
`FeatureFlags` JSON NULL DEFAULT ('{}'),
|
||||||
|
`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`,
|
||||||
|
`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;;
|
||||||
|
|
||||||
|
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,
|
||||||
|
`MaxSteamOfferCount` BIGINT NOT NULL DEFAULT 250,
|
||||||
|
`Maintenance` BOOLEAN DEFAULT FALSE,
|
||||||
|
`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`,
|
||||||
|
`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;;
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
ALTER TABLE CFG_Server
|
||||||
|
DROP COLUMN ShortRoleNameSetOnlyHighest;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE CFG_ServerHistory
|
||||||
|
DROP COLUMN ShortRoleNameSetOnlyHighest;
|
||||||
|
|
||||||
|
|
134
bot/src/bot_data/scripts/1.1.9/1_ShortRoleNameOnlyHighest_up.sql
Normal file
134
bot/src/bot_data/scripts/1.1.9/1_ShortRoleNameOnlyHighest_up.sql
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
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,
|
||||||
|
`DefaultRoleId` BIGINT NULL,
|
||||||
|
`ShortRoleNameSetOnlyHighest` BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
|
`FeatureFlags` JSON NULL DEFAULT ('{}'),
|
||||||
|
`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`,
|
||||||
|
`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;;
|
||||||
|
|
9
bot/src/bot_data/scripts/1.2.0/1_FixUserHistory_down.sql
Normal file
9
bot/src/bot_data/scripts/1.2.0/1_FixUserHistory_down.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
ALTER TABLE UsersHistory
|
||||||
|
DROP COLUMN MessageCount;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE UsersHistory
|
||||||
|
DROP COLUMN ReactionCount;
|
||||||
|
|
||||||
|
|
52
bot/src/bot_data/scripts/1.2.0/1_FixUserHistory_up.sql
Normal file
52
bot/src/bot_data/scripts/1.2.0/1_FixUserHistory_up.sql
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
ALTER TABLE UsersHistory
|
||||||
|
ADD COLUMN ReactionCount BIGINT NOT NULL DEFAULT 0 AFTER XP;
|
||||||
|
|
||||||
|
ALTER TABLE UsersHistory
|
||||||
|
ADD COLUMN MessageCount BIGINT NOT NULL DEFAULT 0 AFTER ReactionCount;
|
||||||
|
|
||||||
|
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,
|
||||||
|
`ReactionCount` BIGINT(20) NOT NULL DEFAULT 0,
|
||||||
|
`MessageCount` BIGINT(20) NOT NULL DEFAULT 0,
|
||||||
|
`Birthday` DATE 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_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;;
|
||||||
|
|
19
bot/src/bot_data/scripts/1.2.0/2_Birthday_down.sql
Normal file
19
bot/src/bot_data/scripts/1.2.0/2_Birthday_down.sql
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
|
190
bot/src/bot_data/scripts/1.2.0/2_Birthday_up.sql
Normal file
190
bot/src/bot_data/scripts/1.2.0/2_Birthday_up.sql
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
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);;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `UsersHistory`
|
||||||
|
(
|
||||||
|
`Id` BIGINT(20) NOT NULL,
|
||||||
|
`DiscordId` BIGINT(20) NOT NULL,
|
||||||
|
`XP` BIGINT(20) NOT NULL DEFAULT 0,
|
||||||
|
`ReactionCount` BIGINT(20) NOT NULL DEFAULT 0,
|
||||||
|
`MessageCount` BIGINT(20) NOT NULL DEFAULT 0,
|
||||||
|
`Birthday` DATE 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_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;
|
||||||
|
|
||||||
|
|
||||||
|
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,
|
||||||
|
`DefaultRoleId` BIGINT NULL,
|
||||||
|
`ShortRoleNameSetOnlyHighest` BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
|
`FeatureFlags` JSON NULL DEFAULT ('{}'),
|
||||||
|
`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`,
|
||||||
|
`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;;
|
||||||
|
|
12
bot/src/bot_data/scripts/1.2.0/3_SteamSpecialOffer_down.sql
Normal file
12
bot/src/bot_data/scripts/1.2.0/3_SteamSpecialOffer_down.sql
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
DROP TABLE `SteamSpecialOffers`;
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE CFG_Server
|
||||||
|
DROP COLUMN ShortRoleNameSetOnlyHighest;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE CFG_ServerHistory
|
||||||
|
DROP COLUMN ShortRoleNameSetOnlyHighest;
|
||||||
|
|
||||||
|
|
23
bot/src/bot_data/scripts/1.2.0/3_SteamSpecialOffer_up.sql
Normal file
23
bot/src/bot_data/scripts/1.2.0/3_SteamSpecialOffer_up.sql
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
ALTER TABLE CFG_Technician
|
||||||
|
DROP COLUMN MaxSteamOfferCount;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE CFG_TechnicianHistory
|
||||||
|
DROP COLUMN MaxSteamOfferCount;
|
||||||
|
|
||||||
|
|
84
bot/src/bot_data/scripts/1.2.0/4_MaxSteamOfferCount_up.sql
Normal file
84
bot/src/bot_data/scripts/1.2.0/4_MaxSteamOfferCount_up.sql
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
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,
|
||||||
|
`MaxSteamOfferCount` BIGINT NOT NULL DEFAULT 250,
|
||||||
|
`Maintenance` BOOLEAN DEFAULT FALSE,
|
||||||
|
`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`,
|
||||||
|
`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;;
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
ALTER TABLE CFG_Technician
|
||||||
|
DROP COLUMN Maintenance;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE CFG_TechnicianHistory
|
||||||
|
DROP COLUMN Maintenance;
|
||||||
|
|
||||||
|
|
84
bot/src/bot_data/scripts/1.2.0/5_MaintenanceMode_up.sql
Normal file
84
bot/src/bot_data/scripts/1.2.0/5_MaintenanceMode_up.sql
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
ALTER TABLE CFG_Technician
|
||||||
|
ADD Maintenance BOOLEAN DEFAULT FALSE AFTER MaxSteamOfferCount;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE CFG_TechnicianHistory
|
||||||
|
ADD Maintenance BOOLEAN DEFAULT FALSE AFTER MaxSteamOfferCount;
|
||||||
|
|
||||||
|
|
||||||
|
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,
|
||||||
|
`MaxSteamOfferCount` BIGINT NOT NULL DEFAULT 250,
|
||||||
|
`Maintenance` BOOLEAN DEFAULT FALSE,
|
||||||
|
`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`,
|
||||||
|
`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;;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user