-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcurrent-entity-erd.dbml
More file actions
245 lines (217 loc) ยท 10.9 KB
/
Copy pathcurrent-entity-erd.dbml
File metadata and controls
245 lines (217 loc) ยท 10.9 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
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
// ํ์ฌ JPA entity ๋ฐ src/main/resources/db/migration/mysql/V1__init_mysql_schema.sql ๊ธฐ์ค
// BaseEntity์ created_at/updated_at์ ์ ํ๋ฆฌ์ผ์ด์
๊ฐ์ฌ(auditing)๋ก ์ฑ์์ง์ง๋ง DB ์ปฌ๋ผ ์์ฒด๋ NULL ํ์ฉ์ด๋ค.
Table regions {
id bigint [pk, increment, note: '์ง์ญ PK']
created_at datetime(6) [note: '์์ฑ ์ผ์ (DB NULL ํ์ฉ)']
updated_at datetime(6) [note: '์์ ์ผ์ (DB NULL ํ์ฉ)']
parent_id bigint [note: '์์ ์ง์ญ FK. ์ต์์ ์ง์ญ์ NULL']
name varchar(50) [not null, note: '์ง์ญ๋ช
']
depth varchar(255) [not null, note: 'RegionDepth: PROVINCE, DISTRICT']
}
Table users {
id bigint [pk, increment, note: '์ฌ์ฉ์ PK']
created_at datetime(6) [note: '์์ฑ ์ผ์ (DB NULL ํ์ฉ)']
updated_at datetime(6) [note: '์์ ์ผ์ (DB NULL ํ์ฉ)']
email varchar(150) [unique, note: '์ฌ์ฉ์ ์ด๋ฉ์ผ. NULL ํ์ฉ']
password_hash varchar(200) [note: '์ผ๋ฐ ๋ก๊ทธ์ธ ๋น๋ฐ๋ฒํธ ํด์. ์์
๋ก๊ทธ์ธ์ NULL']
auth_provider varchar(20) [not null, note: 'LOCAL, KAKAO, GOOGLE, NAVER']
provider_id varchar(50) [note: '์์
๋ก๊ทธ์ธ ์ ๊ณต์์ ์ฌ์ฉ์ ID. LOCAL์ NULL']
role varchar(20) [not null, note: 'USER, ADMIN. ์ ํ๋ฆฌ์ผ์ด์
์์ฑ ๊ธฐ๋ณธ๊ฐ USER']
registration_status varchar(30) [not null, note: 'NOT_STARTED, PROFILE_COMPLETED, ONBOARDING_COMPLETED. ์ ํ๋ฆฌ์ผ์ด์
์์ฑ ๊ธฐ๋ณธ๊ฐ NOT_STARTED']
indexes {
(auth_provider, provider_id) [unique, name: 'uk_users_provider']
}
}
Table user_profiles {
id bigint [pk, increment, note: '์ฌ์ฉ์ ํ๋กํ PK']
created_at datetime(6) [note: '์์ฑ ์ผ์ (DB NULL ํ์ฉ)']
updated_at datetime(6) [note: '์์ ์ผ์ (DB NULL ํ์ฉ)']
user_id bigint [not null, unique, note: '์ฌ์ฉ์ FK. ์ฌ์ฉ์๋น ํ๋กํ 1๊ฐ']
nickname varchar(10) [not null, unique, note: '์ค๋ณต ๋ถ๊ฐ ๋๋ค์']
birth_date date [not null]
gender varchar(20) [not null, note: 'MALE, FEMALE, NONE']
status varchar(20) [not null, note: 'STUDENT, WORKER, JOB_SEEKER, FREELANCER, ETC']
profile_image_url varchar(500) [note: 'ํ๋กํ ์ด๋ฏธ์ง URL. DB NULL ํ์ฉ; ํ์ฌ ์ ํ๋ฆฌ์ผ์ด์
๊ธฐ๋ณธ๊ฐ์ ๋น ๋ฌธ์์ด']
service_terms_agreed boolean [not null]
privacy_policy_agreed boolean [not null]
marketing_agreed boolean [not null, note: '์ ํ๋ฆฌ์ผ์ด์
์์ฑ ๊ธฐ๋ณธ๊ฐ false']
}
Table user_onboardings {
id bigint [pk, increment, note: '์ฌ์ฉ์ ์จ๋ณด๋ฉ PK']
created_at datetime(6) [note: '์์ฑ ์ผ์ (DB NULL ํ์ฉ)']
updated_at datetime(6) [note: '์์ ์ผ์ (DB NULL ํ์ฉ)']
user_id bigint [not null, unique, note: '์ฌ์ฉ์ FK. ์ฌ์ฉ์๋น ์จ๋ณด๋ฉ 1๊ฐ']
}
Table tags {
id bigint [pk, increment, note: 'ํ๊ทธ PK']
created_at datetime(6) [note: '์์ฑ ์ผ์ (DB NULL ํ์ฉ)']
updated_at datetime(6) [note: '์์ ์ผ์ (DB NULL ํ์ฉ)']
name varchar(50) [not null, note: 'ํ๊ทธ๋ช
']
type varchar(50) [not null, note: 'TOPIC_CATEGORY, PREFERENCE_TAG, ACTIVITY_CATEGORY']
tag_group_type varchar(50) [note: 'MOOD, INTENSITY, PURPOSE, DURATION, SIZE']
indexes {
(name, type) [unique, name: 'uk_tags_name_type']
}
}
Table user_onboarding_regions {
id bigint [pk, increment, note: '์จ๋ณด๋ฉ-์ง์ญ ๋งคํ PK']
created_at datetime(6) [note: '์์ฑ ์ผ์ (DB NULL ํ์ฉ)']
updated_at datetime(6) [note: '์์ ์ผ์ (DB NULL ํ์ฉ)']
user_onboarding_id bigint [not null]
region_id bigint [not null]
indexes {
(user_onboarding_id, region_id) [unique, name: 'uk_user_onboarding_regions_onboarding_region']
}
}
Table user_onboarding_tags {
id bigint [pk, increment, note: '์จ๋ณด๋ฉ-ํ๊ทธ ๋งคํ PK']
created_at datetime(6) [note: '์์ฑ ์ผ์ (DB NULL ํ์ฉ)']
updated_at datetime(6) [note: '์์ ์ผ์ (DB NULL ํ์ฉ)']
user_onboarding_id bigint [not null]
tag_id bigint [not null]
indexes {
(user_onboarding_id, tag_id) [unique, name: 'uk_user_onboarding_tags_onboarding_tag']
}
}
Table activities {
id bigint [pk, increment, note: 'ํ๋ PK']
created_at datetime(6) [note: '์์ฑ ์ผ์ (DB NULL ํ์ฉ)']
updated_at datetime(6) [note: '์์ ์ผ์ (DB NULL ํ์ฉ)']
region_id bigint [not null, note: 'ํ๋ ์ง์ญ FK']
title text [not null]
description text [not null]
thumbnail_url text [note: '๋ํ ์ด๋ฏธ์ง URL']
source_url text [not null, note: '์๋ณธ/์ ์ฒญ ํ์ด์ง URL']
address text
organizer text
contact_info text
target text [note: '์ฐธ์ฌ ๋์']
start_at datetime(6)
end_at datetime(6)
recruit_start_at datetime(6)
recruit_end_at datetime(6)
price int [not null, note: '์ ํ๋ฆฌ์ผ์ด์
์์ฑ ๊ธฐ๋ณธ๊ฐ 0']
activity_type varchar(50) [not null, note: 'PROGRAM, ONE_DAY, EVENT, CLUB. ์ ํ๋ฆฌ์ผ์ด์
์์ฑ ๊ธฐ๋ณธ๊ฐ EVENT']
category varchar(50) [not null, note: 'SPORTS, CULTURE, CRAFT, COOKING, PHOTO_VIDEO, HUMANITIES, TRAVEL, LANGUAGE, VOLUNTEER, CAREER']
source_type varchar(50) [not null, note: 'KOPIS, EXHIBITION, SEOUL_CULTURE, SEOUL_RESERVATION, DISCOVERY, URL_MANUAL']
external_id text [note: '์ธ๋ถ ์์คํ
ํ๋ ID']
approval_status varchar(50) [not null, note: 'PENDING, APPROVED, REJECTED. ์ ํ๋ฆฌ์ผ์ด์
์์ฑ ๊ธฐ๋ณธ๊ฐ PENDING']
view_count int [not null, note: '์ ํ๋ฆฌ์ผ์ด์
์์ฑ ๊ธฐ๋ณธ๊ฐ 0']
like_count int [not null, note: '์ ํ๋ฆฌ์ผ์ด์
์์ฑ ๊ธฐ๋ณธ๊ฐ 0']
review_count int [not null, note: '์ ํ๋ฆฌ์ผ์ด์
์์ฑ ๊ธฐ๋ณธ๊ฐ 0']
is_active boolean [not null, note: '์ ํ๋ฆฌ์ผ์ด์
์์ฑ ๊ธฐ๋ณธ๊ฐ true']
Note: 'DB CHECK: source_type์ ํ์ฌ SourceType 6๊ฐ ๊ฐ๋ง ํ์ฉ'
}
Table activity_tags {
id bigint [pk, increment, note: 'ํ๋-ํ๊ทธ ๋งคํ PK']
created_at datetime(6) [note: '์์ฑ ์ผ์ (DB NULL ํ์ฉ)']
updated_at datetime(6) [note: '์์ ์ผ์ (DB NULL ํ์ฉ)']
activity_id bigint [not null]
tag_id bigint [not null]
indexes {
(activity_id, tag_id) [unique, name: 'uk_activity_tags_activity_tag']
}
}
Table activity_images {
id bigint [pk, increment, note: 'ํ๋ ์ด๋ฏธ์ง PK']
created_at datetime(6) [note: '์์ฑ ์ผ์ (DB NULL ํ์ฉ)']
updated_at datetime(6) [note: '์์ ์ผ์ (DB NULL ํ์ฉ)']
activity_id bigint [not null]
image_url varchar(500) [not null]
sort_order int [not null, note: '์ ํ๋ฆฌ์ผ์ด์
์์ฑ ๊ธฐ๋ณธ๊ฐ 0']
is_thumbnail boolean [not null, note: '์ ํ๋ฆฌ์ผ์ด์
์์ฑ ๊ธฐ๋ณธ๊ฐ false']
indexes {
(activity_id, sort_order) [unique, name: 'uk_activity_images_activity_sort_order']
}
}
Table activity_favorites {
id bigint [pk, increment, note: 'ํ๋ ์ฐ PK']
created_at datetime(6) [note: '์์ฑ ์ผ์ (DB NULL ํ์ฉ)']
updated_at datetime(6) [note: '์์ ์ผ์ (DB NULL ํ์ฉ)']
user_id bigint [not null]
activity_id bigint [not null]
indexes {
(user_id, activity_id) [unique, name: 'uk_activity_favorites_user_activity']
}
}
Table activity_reviews {
id bigint [pk, increment, note: 'ํ๋ ํ๊ธฐ PK']
created_at datetime(6) [note: '์์ฑ ์ผ์ (DB NULL ํ์ฉ)']
updated_at datetime(6) [note: '์์ ์ผ์ (DB NULL ํ์ฉ)']
user_id bigint [not null]
activity_id bigint [not null]
rating int [not null, note: 'API ๊ฒ์ฆ ๋ฒ์ 1~5; DB CHECK๋ ์์']
reason text
like_count int [not null, note: '์ ํ๋ฆฌ์ผ์ด์
์์ฑ ๊ธฐ๋ณธ๊ฐ 0']
indexes {
(user_id, activity_id) [unique, name: 'uk_activity_reviews_user_activity']
}
}
Table advertisements {
id bigint [pk, increment, note: '๊ด๊ณ PK']
created_at datetime(6) [note: '์์ฑ ์ผ์ (DB NULL ํ์ฉ)']
updated_at datetime(6) [note: '์์ ์ผ์ (DB NULL ํ์ฉ)']
title varchar(100) [not null]
image_url varchar(500) [not null]
redirect_url varchar(500) [not null]
position varchar(50) [not null, note: 'ACTIVITY_LIST, MAIN_BANNER']
sort_order int [not null, note: '์ ํ๋ฆฌ์ผ์ด์
์์ฑ ๊ธฐ๋ณธ๊ฐ 0']
start_at datetime(6)
end_at datetime(6)
view_count int [not null, note: '์ ํ๋ฆฌ์ผ์ด์
์์ฑ ๊ธฐ๋ณธ๊ฐ 0']
click_count int [not null, note: '์ ํ๋ฆฌ์ผ์ด์
์์ฑ ๊ธฐ๋ณธ๊ฐ 0']
is_active boolean [not null, note: '์ ํ๋ฆฌ์ผ์ด์
์์ฑ ๊ธฐ๋ณธ๊ฐ true']
}
Table raw_activities {
id bigint [pk, increment, note: '์ธ๋ถ ์์ง ์๋ณธ ํ๋ PK']
created_at datetime(6) [note: '์์ฑ ์ผ์ (DB NULL ํ์ฉ)']
updated_at datetime(6) [note: '์์ ์ผ์ (DB NULL ํ์ฉ)']
source_type varchar(50) [not null, note: 'KOPIS, EXHIBITION, SEOUL_CULTURE, SEOUL_RESERVATION, DISCOVERY, URL_MANUAL']
external_id varchar(100)
request_url varchar(1000) [not null]
content_type varchar(50) [not null]
payload text [not null, note: '์์ง ์๋ณธ ์๋ต']
Note: 'DB CHECK: source_type์ ํ์ฌ SourceType 6๊ฐ ๊ฐ๋ง ํ์ฉ'
}
Table activity_preference_vectors {
id bigint [pk, increment, note: 'ํ๋ ์ทจํฅ ๋ฒกํฐ PK']
activity_id bigint [not null, unique, note: 'ํ๋๋น ๋ฒกํฐ 1๊ฐ']
embedding json [not null, note: '์ ํ๋ฆฌ์ผ์ด์
์์ ๊ฒ์ฆํ๋ 14์ฐจ์ float ๋ฐฐ์ด']
vector_version int [not null, note: 'ํ์ฌ ์ ํ๋ฆฌ์ผ์ด์
๋ฒ์ 1']
created_at datetime(6) [not null]
updated_at datetime(6) [not null]
}
Table user_preference_vectors {
id bigint [pk, increment, note: '์ฌ์ฉ์ ์ทจํฅ ๋ฒกํฐ PK']
user_id bigint [not null, unique, note: '์ฌ์ฉ์๋น ๋ฒกํฐ 1๊ฐ']
embedding json [not null, note: '์ ํ๋ฆฌ์ผ์ด์
์์ ๊ฒ์ฆํ๋ 14์ฐจ์ float ๋ฐฐ์ด']
vector_version int [not null, note: 'ํ์ฌ ์ ํ๋ฆฌ์ผ์ด์
๋ฒ์ 1']
created_at datetime(6) [not null]
updated_at datetime(6) [not null]
}
Table tag_preference_vectors {
id bigint [pk, increment, note: 'ํ๊ทธ ์ทจํฅ ๋ฒกํฐ PK']
tag_id bigint [not null, unique, note: 'ํ๊ทธ๋น ๋ฒกํฐ 1๊ฐ']
embedding json [not null, note: '์ ํ๋ฆฌ์ผ์ด์
์์ ๊ฒ์ฆํ๋ 14์ฐจ์ float ๋ฐฐ์ด']
vector_version int [not null, note: 'ํ์ฌ ์ ํ๋ฆฌ์ผ์ด์
๋ฒ์ 1']
created_at datetime(6) [not null]
updated_at datetime(6) [not null]
}
Ref: regions.parent_id > regions.id [delete: set null]
Ref: user_profiles.user_id > users.id [delete: cascade]
Ref: user_onboardings.user_id > users.id [delete: cascade]
Ref: user_onboarding_regions.user_onboarding_id > user_onboardings.id [delete: cascade]
Ref: user_onboarding_regions.region_id > regions.id [delete: cascade]
Ref: user_onboarding_tags.user_onboarding_id > user_onboardings.id [delete: cascade]
Ref: user_onboarding_tags.tag_id > tags.id [delete: cascade]
Ref: activities.region_id > regions.id
Ref: activity_tags.activity_id > activities.id [delete: cascade]
Ref: activity_tags.tag_id > tags.id [delete: cascade]
Ref: activity_images.activity_id > activities.id [delete: cascade]
Ref: activity_favorites.user_id > users.id [delete: cascade]
Ref: activity_favorites.activity_id > activities.id [delete: cascade]
Ref: activity_reviews.user_id > users.id [delete: cascade]
Ref: activity_reviews.activity_id > activities.id [delete: cascade]
Ref: activity_preference_vectors.activity_id > activities.id [delete: cascade]
Ref: user_preference_vectors.user_id > users.id [delete: cascade]
Ref: tag_preference_vectors.tag_id > tags.id [delete: cascade]