· 5 years ago · May 31, 2020, 01:04 PM
1CREATE TABLE IF NOT EXISTS Players (
2 PlayerId BIGINT NOT NULL,
3 PlayerName NVARCHAR(255) NOT NULL,
4 PlayerCountry CHAR(2) NULL,
5 PlayerCreated DATETIME NOT NULL,
6 PlayerLastActivity DATETIME NOT NULL,
7 CONSTRAINT PK_Players PRIMARY KEY (PlayerId)
8);
9
10CREATE TABLE IF NOT EXISTS Bans (
11 BanId INT NOT NULL AUTO_INCREMENT,
12 PlayerId BIGINT NOT NULL,
13 PunisherId BIGINT NOT NULL,
14 BanReason VARCHAR(255) NULL,
15 BanDuration INT(11) NULL,
16 BanCreated DATETIME NOT NULL,
17 SendFlag TINYINT NOT NULL DEFAULT 0,
18 CONSTRAINT PK_BanId PRIMARY KEY (BanId),
19 CONSTRAINT FK_Players_PlayerId FOREIGN KEY (PlayerId) REFERENCES Players(PlayerId),
20 CONSTRAINT FK_Players_PunisherId FOREIGN KEY (PunisherId) REFERENCES Players(PlayerId)
21);
22
23CREATE TABLE IF NOT EXISTS Punishments (
24 PunishmentId INT NOT NULL AUTO_INCREMENT,
25 PlayerId BIGINT NOT NULL,
26 PunisherId BIGINT NOT NULL,
27 Type VARCHAR(55) NOT NULL,
28 Reason VARCHAR(255) NULL,
29 CreateDate DATETIME NOT NULL,
30 CONSTRAINT PK_Punishment PRIMARY KEY (PunishmentId),
31 CONSTRAINT FK_Punishments_PlayerId FOREIGN KEY (PlayerId) REFERENCES Players(PlayerId),
32 CONSTRAINT FK_Punishments_PunisherId FOREIGN KEY (PunisherId) REFERENCES Players(PlayerId)
33);