#428 #437

Merged
edraft merged 20 commits from #428 into master 2023-11-15 17:39:44 +01:00
2 changed files with 82 additions and 0 deletions
Showing only changes of commit 407ec08463 - Show all commits

View File

@ -0,0 +1,12 @@
DROP TABLE `Servers`;
DROP TABLE `Users`;
DROP TABLE `Clients`;
DROP TABLE `KnownUsers`;
DROP TABLE `UserJoinedServers`;
DROP TABLE `UserJoinedVoiceChannel`;

View File

@ -0,0 +1,70 @@
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`)
);