From be0c29daef53c5bb076aedeab5e983f1468dba45 Mon Sep 17 00:00:00 2001 From: jtieri <37750742+jtieri@users.noreply.github.com> Date: Thu, 16 Sep 2021 00:28:27 -0500 Subject: [PATCH] WIP: DB models & design --- assets/setup.sql | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/assets/setup.sql b/assets/setup.sql index 8de6052..2f6141b 100644 --- a/assets/setup.sql +++ b/assets/setup.sql @@ -1,2 +1,35 @@ CREATE DATABASE habbgo; +CREATE TABLE Player { + ID INT NOT NULL UNIQUE, + Username VARCHAR(16) NOT NULL UNIQUE, + Sex CHAR(1) NOT NULL, + Figure TEXT NOT NULL, + PoolFigure TEXT, + Film INT DEFAULT 0, + Credits INT DEFAULT 0, + Tickets INT DEFAULT 0, + Motto TEXT DEFAULT 'Project HabbGo.', + ConsoleMotto TEXT DEFAULT 'HabbGo Rocks!', + DisplayBadge BOOL DEFAULT false, + CurrentBadge INT, + SoundEnabled BOOL DEFAULT true, + CreatedOn DATETIME NOT NULL, + LastOnline DATETIME, + FOREIGN KEY (CurrentBadge) REFERENCES Badge(ID) + PRIMARY KEY (ID) +}; + +CREATE TABLE Badge { + ID INT NOT NULL UNIQUE, + Code VARCHAR(6) UNIQUE, + PRIMARY KEY (ID) +}; + +CREATE TABLE PlayerBadges { + PlayerID INT NOT NULL, + Badge INT, + FOREIGN KEY (PlayerID) REFERENCES Player(ID) + FOREIGN KEY (Badge) REFERENCES Badge(ID) + PRIMARY KEY (PlayerID) +}; \ No newline at end of file