#428 #436
12
bot/src/bot_data/scripts/0.1/Initial_down.sql
Normal file
12
bot/src/bot_data/scripts/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`;
|
||||
|
70
bot/src/bot_data/scripts/0.1/Initial_up.sql
Normal file
70
bot/src/bot_data/scripts/0.1/Initial_up.sql
Normal 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`)
|
||||
);
|
Loading…
Reference in New Issue
Block a user