-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase.dbml
131 lines (107 loc) · 4.19 KB
/
database.dbml
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
Project Charkchalk {
database_type: 'PostgreSQL'
Note: '''
# Charkchalk Database Documentation
'''
}
Table branches {
id int [pk, increment]
Note: '''
## 分支
### 概述
分支代表著在不同時間,但內容相同課程的總和。所有分支的課程名稱應該要相同,故分支名稱會直接取底下的課程名稱做使用。
預想上分支在沒有指定所屬分支的課程創建時會被建立。
例如:
1. 108 學年度上學期 計算機概論
2. 109 學年度上學期 計算機概論
3. 110 學年度上學期 計算機概論
都應該要算在同一個課程分支中。
'''
}
Table courses {
id int [pk, increment]
code varchar(255) [note: "選課代號(如果適用)"]
in_branch int [ref: > branches.id, not null, note: "所屬的分支"]
predecessor int [ref: > courses.id, note: "課程前身(例如某年計算機概論因教授覺得學生不行,突然分成了兩門課。其一為資訊入門、其二為專業英文導讀,則此二者的前身都會是計算機概論)"]
name varchar(255) [not null, note: "課程名稱"]
organization int [not null, ref: > organizations.id, note: "所屬組織(通常是學校,如靜宜大學等)"]
description varchar(255) [note: "課程敘述"]
link varchar(255) [not null, note: "課程連結(通常是課程網頁)"]
credit int [note: "學分數"]
tags int [ref: <> tags.id, note: "課程屬性(如必修、選修、必選修等)"]
places int [not null, ref: <> places.id, note: "上課地點"]
date_range int [ref: > date_ranges.id, note: "開課日期範圍"]
time_range int [ref: <> time_ranges.id, note: "每週上課時間"]
hosts int [ref: <> persons.id, note: "講師、負責人"]
note: "課程"
}
Table tags {
id int [pk, increment]
name varchar(255) [not null, note: "屬性名稱"]
description varchar(255) [note: "屬性敘述"]
limit tag_limit [note: "屬性限制(該屬性僅能套用在課程 or 組合上)"]
note: "屬性"
}
Table places {
id int [pk, increment]
name varchar(255) [not null, note: "地點名稱"]
description varchar(255) [not null, note: "地點敘述"]
parent int [ref: < places.child, note: "父地點(例如主顧樓 509 > 主顧樓 > 靜宜大學)"]
child int
note: "地點"
}
Table date_ranges {
id int [pk, increment]
name varchar(255) [not null, note:"範圍名稱(可能是靜宜大學 110 學年度上學期)"]
description varchar(255) [note: "範圍敘述"]
start_date date [not null, note:"範圍開始日期"]
end_date date [not null, note:"範圍結束日期"]
note: "開課的日期範圍"
}
Table time_ranges {
id int [pk, increment]
day weekday [not null, note: "星期幾"]
start_time time [not null, note: "開始時間"]
end_time time [not null, note: "結束時間"]
note: "每週的幾點到幾點"
}
Table persons {
id int [pk, increment]
name varchar(255) [not null]
description varchar(255) [not null]
link varchar(255) [not null, note: "通常為教師的個人網站"]
note: "人物"
}
Table combinations {
id int [pk, increment]
name varchar(255) [not null, note: "組合名稱"]
organization int [not null, ref: > organizations.id, note: "所屬組織(通常是學校,如靜宜大學等)"]
description varchar(255) [not null, note: "組合敘述"]
tags int [ref: <> tags.id, note: "組合屬性(如系所開的課、學程等)"]
courses int [ref: <> courses.id, note: "課程們"]
note: '''
## 組合
### 概述
代表一組課程的組合,例如資工系課程、或是雲端應用學程等
'''
}
Table organizations {
id int [pk, increment]
name varchar(255) [not null, note: "組織名稱(通常是校名)"]
description varchar(255) [not null, note: "組織敘述(通常會給學校首頁或 wiki 資訊)"]
tags int [ref: <> tags.id, note: "組織屬性(例如學校、政府計畫等)"]
}
enum weekday {
sunday
monday
tuesday
wednesday
thursday
friday
saturday
}
enum tag_limit {
courses
combinations
organizations
}