This repository has been archived by the owner on Dec 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tables.sql
53 lines (49 loc) · 1.59 KB
/
tables.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
42
43
44
45
46
47
48
49
50
51
52
53
CREATE TABLE rpg_players (
id CHAR(36) NOT NULL PRIMARY KEY,
name VARCHAR(120) NOT NULL,
email VARCHAR(180) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL,
gender VARCHAR(30),
age INT,
experience INT,
photo VARCHAR(255),
description VARCHAR(255),
phone_number VARCHAR(20),
instagram VARCHAR(180)
);
CREATE TABLE rpg_master_style (
id CHAR(36) NOT NULL PRIMARY KEY,
style_name VARCHAR(120) NOT NULL,
style_description VARCHAR(255) NOT NULL,
master_id CHAR(36) NOT NULL,
FOREIGN KEY (master_id) REFERENCES rpg_players(id)
);
CREATE TABLE rpg_character_player (
id CHAR(36) NOT NULL PRIMARY KEY,
character_name VARCHAR(120) NOT NULL,
game_system VARCHAR(255) NOT NULL,
class VARCHAR(180) NOT NULL,
level INT NOT NULL,
skills VARCHAR(255) NOT NULL,
equipment VARCHAR(255) NOT NULL,
other_details VARCHAR(255),
player_id CHAR(36) NOT NULL,
FOREIGN KEY (player_id) REFERENCES rpg_players(id)
);
CREATE TABLE rpg_table (
id CHAR(36) NOT NULL PRIMARY KEY,
table_name VARCHAR(180) NOT NULL,
date DATE NOT NULL,
time TIME NOT NULL,
campaign_theme VARCHAR(180) NOT NULL,
campaign_theme_description VARCHAR(180) NOT NULL,
master_style_id CHAR(36) NOT NULL,
FOREIGN KEY (master_style_id) REFERENCES rpg_master_style(id)
);
CREATE TABLE rpg_table_participants (
id CHAR(36) NOT NULL PRIMARY KEY,
rpg_table_id CHAR(36) NOT NULL,
character_id CHAR(36) NOT NULL,
FOREIGN KEY (rpg_table_id) REFERENCES rpg_table(id),
FOREIGN KEY (character_id) REFERENCES rpg_character_player(id)
);