-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSynergyDBSchema.sql
41 lines (35 loc) · 1.07 KB
/
SynergyDBSchema.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
39
40
41
CREATE DATABASE SynergyDB;
CREATE TABLE Races
(
Id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR(255) NOT NULL,
Origin VARCHAR(255) NOT NULL,
CONSTRAINT Name UNIQUE (Name)
);
CREATE TABLE Classes
(
Id int NOT NULL PRIMARY KEY AUTO_INCREMENT COMMENT 'Primary Key',
Name VARCHAR(255) NOT NULL,
Role ENUM("Tank", "Damage", "Healer") NOT NULL,
Resource ENUM("Fervor", "Focus", "Mana", "Faith", "Energy", "Soul") NOT NULL,
CONSTRAINT Name UNIQUE (Name)
);
CREATE TABLE Adventurers
(
Id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR(255) NOT NULL,
`Rank` ENUM("Rookie", "Veteran", "Elite", "Master", "Legendary") NOT NULL,
Race int NOT NULL,
Class int NOT NULL,
Foreign Key (Race) REFERENCES Races(Id),
Foreign Key (Class) REFERENCES Classes(Id)
);
CREATE TABLE Parties
(
Id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR(255) NOT NULL,
DateFounded DATETIME
);
ALTER TABLE Adventurers ADD Party int NOT NULL;
ALTER TABLE Adventurers
ADD CONSTRAINT Party Foreign Key (Party) REFERENCES Parties(Id);