forked from TeeworldsCN/teeworlds-infclassR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
infc.sql
38 lines (36 loc) · 1.5 KB
/
infc.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
-- write by FFS
DROP TABLE IF EXISTS `tw_infc_RoundScore`;
DROP TABLE IF EXISTS `tw_infc_Rounds`;
DROP TABLE IF EXISTS `tw_Users`;
CREATE TABLE IF NOT EXISTS `tw_Users` (
`UserId` INT NOT NULL AUTO_INCREMENT,
`Username` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`Email` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`PasswordHash` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`Level` INT DEFAULT '0' NOT NULL,
`RegisterDate` DATETIME NOT NULL DEFAULT NOW(),
`RegisterIp` VARCHAR(64) NOT NULL,
PRIMARY KEY (`UserId`)
) DEFAULT CHARSET=utf8 ;
CREATE TABLE IF NOT EXISTS `tw_infc_Rounds` (
`RoundId` INT NOT NULL AUTO_INCREMENT,
`MapName` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`NumPlayersMin` INT NOT NULL,
`NumPlayersMax` INT NOT NULL,
`NumWinners` INT NOT NULL,
`RoundDate` DATETIME NOT NULL DEFAULT NOW(),
`RoundDuration` INT NOT NULL,
PRIMARY KEY (`RoundId`)
) DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tw_infc_RoundScore` (
`RoundScoreId` INT NOT NULL AUTO_INCREMENT,
`UserId` INT NOT NULL,
`RoundId` INT NOT NULL,
`MapName` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`ScoreType` INT NOT NULL,
`ScoreDate` DATETIME NOT NULL DEFAULT NOW(),
`Score` INT NOT NULL,
PRIMARY KEY (`RoundScoreId`),
FOREIGN KEY (`UserId`) REFERENCES tw_Users(`UserId`),
FOREIGN KEY (`RoundId`) REFERENCES tw_infc_Rounds(`RoundId`)
) DEFAULT CHARSET=utf8;