DROP TABLE IF EXISTS Matchmaker;
DROP TABLE IF EXISTS Player;
DROP TABLE IF EXISTS Cards;

CREATE TABLE Player 
(
PlayerID int(9) UNIQUE AUTO_INCREMENT NOT NULL,
Username varchar(30) UNIQUE NOT NULL,
Email varchar(50) UNIQUE NOT NULL,
Password varchar(50) NOT NULL, -- ASK LEE whevener it should be unique 
Djoined date NOT NULL,
Wins int(6),
Loss int(6),
Elo int(6),
Age int(2) NOT NULL,
Background enum('Red','Blue','Green'),
PRIMARY KEY(PlayerID)
);

CREATE TABLE Matchmaker
(
PlayerID int(9) NOT NULL,
PosQue int(4) UNIQUE NOT NULL AUTO_INCREMENT, -- Position in Que
Elo int(6),
PRIMARY KEY (PosQue),
FOREIGN KEY (PlayerID) REFERENCES Player(PlayerID)
-- FOREIGN KEY (Elo) REFERENCES Player(Elo) -- This one will not work, no clue why
);

CREATE TABLE Cards
(
CardID int(3) UNIQUE AUTO_INCREMENT,
Cname varchar(30),
Cdesc varchar(100),
Cattack int(3),
Cdefense int(3),
Caction varchar(100),
PRIMARY KEY (CardID)
);
