-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdbdiagram_design.txt
More file actions
69 lines (55 loc) · 1.39 KB
/
dbdiagram_design.txt
File metadata and controls
69 lines (55 loc) · 1.39 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
table "category" {
id integer [primary key, not null]
name text [unique, not null] // Men, Women, U18
}
table "event_type" {
id integer [primary key, not null]
name text [unique, not null] // WM, EM, Freundschaftsspiel
}
table "sport" {
id integer [primary key, not null]
name text [unique, not null] // Football, Basketball
}
table "team" {
id integer [primary key, not null]
name text [unique, not null]
country_code char(3) // AUT, DE
league text
}
table "team_competition_membership" {
competition_id int [not null, ref: - competition.id]
team_id int [not null, ref: - team.id]
indexes {
(competition_id, team_id) [pk]
}
}
table "venue" {
id integer [primary key, not null]
name text [not null]
city text [not null]
capacity int
}
table "competition" {
id integer [pk]
sport_id integer [not null, ref: > sport.id]
category_id integer [ref: > category.id]
name text [not null]
year int
indexes {
(sport_id, name, year) [unique]
}
}
table "event" {
id int [pk]
competition_id int [not null, ref: - competition.id]
event_type_id int [not null, ref: - event_type.id]
home_team_id int [not null, ref: - team.id]
away_team_id int [not null, ref: - team.id]
venue_id int [not null, ref: > venue.id]
event_datetime timesetamp [not null] // with timezone
name text
description text
indexes {
(venue_id, event_datetime) [unique]
}
}