#428 #437
12
bot/src/bot_data/scripts/0.1.0/1_Initial_down.sql
Normal file
12
bot/src/bot_data/scripts/0.1.0/1_Initial_down.sql
Normal file
@ -0,0 +1,12 @@
|
||||
DROP TABLE `Servers`;
|
||||
|
||||
DROP TABLE `Users`;
|
||||
|
||||
DROP TABLE `Clients`;
|
||||
|
||||
DROP TABLE `KnownUsers`;
|
||||
|
||||
DROP TABLE `UserJoinedServers`;
|
||||
|
||||
DROP TABLE `UserJoinedVoiceChannel`;
|
||||
|
72
bot/src/bot_data/scripts/0.1.0/1_Initial_up.sql
Normal file
72
bot/src/bot_data/scripts/0.1.0/1_Initial_up.sql
Normal file
@ -0,0 +1,72 @@
|
||||
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`)
|
||||
);
|
||||
|
||||
|
4
bot/src/bot_data/scripts/0.2.2/1_AutoRole_down.sql
Normal file
4
bot/src/bot_data/scripts/0.2.2/1_AutoRole_down.sql
Normal file
@ -0,0 +1,4 @@
|
||||
DROP TABLE `AutoRole`;
|
||||
|
||||
DROP TABLE `AutoRoleRules`;
|
||||
|
26
bot/src/bot_data/scripts/0.2.2/1_AutoRole_up.sql
Normal file
26
bot/src/bot_data/scripts/0.2.2/1_AutoRole_up.sql
Normal file
@ -0,0 +1,26 @@
|
||||
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`)
|
||||
);
|
||||
|
||||
|
4
bot/src/bot_data/scripts/0.3.0/1_Api_down.sql
Normal file
4
bot/src/bot_data/scripts/0.3.0/1_Api_down.sql
Normal file
@ -0,0 +1,4 @@
|
||||
DROP TABLE `AuthUsers`;
|
||||
|
||||
DROP TABLE `AuthUserUsersRelations`;
|
||||
|
34
bot/src/bot_data/scripts/0.3.0/1_Api_up.sql
Normal file
34
bot/src/bot_data/scripts/0.3.0/1_Api_up.sql
Normal file
@ -0,0 +1,34 @@
|
||||
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`)
|
||||
);
|
||||
|
||||
|
2
bot/src/bot_data/scripts/0.3.0/2_Level_down.sql
Normal file
2
bot/src/bot_data/scripts/0.3.0/2_Level_down.sql
Normal file
@ -0,0 +1,2 @@
|
||||
DROP TABLE `Levels`;
|
||||
|
15
bot/src/bot_data/scripts/0.3.0/2_Level_up.sql
Normal file
15
bot/src/bot_data/scripts/0.3.0/2_Level_up.sql
Normal file
@ -0,0 +1,15 @@
|
||||
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`)
|
||||
);
|
||||
|
||||
|
2
bot/src/bot_data/scripts/0.3.0/3_Stats_down.sql
Normal file
2
bot/src/bot_data/scripts/0.3.0/3_Stats_down.sql
Normal file
@ -0,0 +1,2 @@
|
||||
DROP TABLE `Statistics`;
|
||||
|
14
bot/src/bot_data/scripts/0.3.0/3_Stats_up.sql
Normal file
14
bot/src/bot_data/scripts/0.3.0/3_Stats_up.sql
Normal file
@ -0,0 +1,14 @@
|
||||
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`)
|
||||
);
|
||||
|
||||
|
4
bot/src/bot_data/scripts/0.3.0/4_AutoRoleFix_down.sql
Normal file
4
bot/src/bot_data/scripts/0.3.0/4_AutoRoleFix_down.sql
Normal file
@ -0,0 +1,4 @@
|
||||
ALTER TABLE AutoRoles
|
||||
DROP COLUMN DiscordChannelId;
|
||||
|
||||
|
4
bot/src/bot_data/scripts/0.3.0/4_AutoRoleFix_up.sql
Normal file
4
bot/src/bot_data/scripts/0.3.0/4_AutoRoleFix_up.sql
Normal file
@ -0,0 +1,4 @@
|
||||
ALTER TABLE AutoRoles
|
||||
ADD DiscordChannelId BIGINT NOT NULL AFTER ServerId;
|
||||
|
||||
|
@ -0,0 +1,2 @@
|
||||
DROP TABLE `UserMessageCountPerHour`;
|
||||
|
@ -0,0 +1,14 @@
|
||||
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`)
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user