From 6b7dd6042d7e74369cb9101e26b376cbd4ed64d4 Mon Sep 17 00:00:00 2001 From: alwayscompiling Date: Fri, 25 Nov 2022 14:15:55 -0500 Subject: [PATCH] Add files for docker sql server. --- MySQL_docker/Dockerfile | 5 ++++ MySQL_docker/highscores_database.sql | 41 ++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 MySQL_docker/Dockerfile create mode 100644 MySQL_docker/highscores_database.sql diff --git a/MySQL_docker/Dockerfile b/MySQL_docker/Dockerfile new file mode 100644 index 0000000..53f2e39 --- /dev/null +++ b/MySQL_docker/Dockerfile @@ -0,0 +1,5 @@ +FROM mysql:latest + +ENV MYSQL_ROOT_PASSWORD=root + +COPY highscores_database.sql /docker-entrypoint-initdb.d/ \ No newline at end of file diff --git a/MySQL_docker/highscores_database.sql b/MySQL_docker/highscores_database.sql new file mode 100644 index 0000000..c55e41b --- /dev/null +++ b/MySQL_docker/highscores_database.sql @@ -0,0 +1,41 @@ +CREATE DATABASE highscores; +use highscores; + +CREATE TABLE Guilds( + GuildId int not null, + SubmissionChannel int, + UsernameLength smallint DEFAULT 12, + VerificationChannel int, + PRIMARY KEY (GuildId) +); + +CREATE TABLE CategoryGroups( + ChannelId int, + GroupId int not null AUTO_INCREMENT, + GroupName varchar(50) not null, + GuildId int not null, + MessageId int, + PadLength smallint not null DEFAULT 26, + Size smallint not null, -- unsure if I like this name. Also unsure belong here or in Category + FOREIGN KEY (GuildId) REFERENCES Guilds(GuildId), + PRIMARY KEY (GroupId) +); + +CREATE TABLE Categories( + CategoryId int not null AUTO_INCREMENT, + CategoryName varchar(30) not null, + GroupId int not null, + IsAscending boolean not null DEFAULT true, + IsTimeRecord boolean not null DEFAULT false, + IsValidated boolean not null DEFAULT true, + FOREIGN KEY (GroupId) REFERENCES CategoryGroups(GroupId), + 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 not null, + FOREIGN KEY (CategoryId) REFERENCES Categories(CategoryId), + CONSTRAINT PKScore PRIMARY KEY (CategoryId, UserName) -- i think this means there isnt a column for this key but the key is made up of categoryid and username +); \ No newline at end of file