diff --git a/highscores_database.sql b/highscores_database.sql deleted file mode 100644 index 55fb011..0000000 --- a/highscores_database.sql +++ /dev/null @@ -1,56 +0,0 @@ -CREATE DATABASE highscores; -use highscores; - -CREATE TABLE Guilds( - GuildId bigint unsigned not null unique, - GuildName varchar(95) not null, - SubmissionChannel bigint unsigned, -- deprecated, is not used anymore. - VerificationChannel bigint unsigned, - Active boolean DEFAULT true, - PRIMARY KEY (GuildId) -); - -CREATE TABLE CategoryGroups( - GroupId int unsigned not null unique AUTO_INCREMENT, - GroupName varchar(50) not null, - ChannelId bigint unsigned, - GuildId bigint unsigned not null, - MessageId bigint unsigned, - PadLength smallint not null DEFAULT 26, - UsernameLength smallint DEFAULT 12, - CONSTRAINT UniqueGuildCategoryGroup UNIQUE (GuildId, GroupName), - FOREIGN KEY (GuildId) REFERENCES Guilds(GuildId) ON DELETE CASCADE, - PRIMARY KEY (GroupId) -); - -CREATE TABLE Categories( - CategoryId int unsigned not null unique AUTO_INCREMENT, - CategoryName varchar(30) not null, - GroupId int unsigned not null, - Size smallint not null DEFAULT 3, - IsAscending boolean not null DEFAULT true, - IsTimeRecord boolean not null DEFAULT false, - IsValidated boolean not null DEFAULT true, - CONSTRAINT UniqueCategoryInGroup UNIQUE (GroupId, CategoryName), - FOREIGN KEY (GroupId) REFERENCES CategoryGroups(GroupId) ON DELETE CASCADE, - PRIMARY Key (CategoryId) -); - -CREATE TABLE Scores( - UserName varchar(30) not null, - Score float not null, -- Maybe should have time and int scores?? timestamp type? - CategoryId int unsigned not null, - FOREIGN KEY (CategoryId) REFERENCES Categories(CategoryId) ON DELETE CASCADE, - PRIMARY KEY (CategoryId, UserName) -); - -CREATE TABLE Submissions( - CategoryId int unsigned not null, - GroupId int unsigned not null, - GuildId bigint unsigned not null, - MessageId bigint unsigned not null, - Score varchar(30) not null, -- Score is stored as a string until converted during submission - UserId bigint unsigned not null, - UserName varchar(30) not null, - PRIMARY KEY (CategoryId, UserName) -- one submission a category per user. -); \ No newline at end of file