-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdatabase-schema.dbml
More file actions
386 lines (349 loc) · 9.62 KB
/
database-schema.dbml
File metadata and controls
386 lines (349 loc) · 9.62 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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
// Atria Database Schema
// Database: atria_dev
// Generated from PostgreSQL schema export
Table direct_message_threads {
id bigint [primary key, not null, increment]
user1_id bigint [not null]
user2_id bigint [not null]
is_encrypted boolean
created_at timestamptz [default: `CURRENT_TIMESTAMP`]
last_message_at timestamptz [default: `CURRENT_TIMESTAMP`]
event_scope_id bigint
user1_cutoff timestamptz
user2_cutoff timestamptz
indexes {
(user1_id, user2_id, event_scope_id)
}
}
Table organization_users {
organization_id bigint [primary key, not null]
user_id bigint [primary key, not null]
role varchar [not null]
created_at timestamptz [default: `CURRENT_TIMESTAMP`]
}
Table organizations {
id bigint [primary key, not null, increment]
name text [not null]
created_at timestamptz [default: `CURRENT_TIMESTAMP`]
updated_at timestamptz
mux_token_id varchar(255)
mux_token_secret text
mux_signing_key_id varchar(255)
mux_signing_private_key text
}
Table user_encryption_keys {
id bigint [primary key, not null, increment]
user_id bigint [not null]
public_key text [not null]
created_at timestamptz [default: `CURRENT_TIMESTAMP`]
indexes {
user_id
}
}
Table direct_messages {
id bigint [primary key, not null, increment]
thread_id bigint [not null]
sender_id bigint [not null]
content text [not null]
encrypted_content text
status varchar
created_at timestamptz [default: `CURRENT_TIMESTAMP`]
}
Table connections {
id bigint [primary key, not null, increment]
requester_id bigint [not null]
recipient_id bigint [not null]
status varchar
icebreaker_message text [not null]
originating_event_id bigint
created_at timestamptz [default: `CURRENT_TIMESTAMP`]
updated_at timestamptz
indexes {
(recipient_id, status, created_at)
(recipient_id, requester_id)
(requester_id, recipient_id)
}
}
Table chat_messages {
id bigint [primary key, not null, increment]
room_id bigint [not null]
user_id bigint [not null]
content text [not null]
created_at timestamptz [default: `CURRENT_TIMESTAMP`]
deleted_at timestamptz
deleted_by_id bigint
}
Table session_speakers {
session_id bigint [primary key, not null]
user_id bigint [primary key, not null]
role varchar [not null]
order bigint
created_at timestamptz [default: `CURRENT_TIMESTAMP`]
indexes {
(session_id, order)
}
}
Table sponsors {
id bigint [primary key, not null, increment]
event_id bigint [not null]
name varchar(255) [not null]
description text
website_url varchar(500)
logo_url varchar(500)
contact_name varchar(255)
contact_email varchar(255)
contact_phone varchar(50)
tier_id varchar(50)
custom_benefits varchar
display_order double
is_active boolean
featured boolean
social_links varchar
created_at timestamptz [default: `CURRENT_TIMESTAMP`]
updated_at timestamptz
}
Table event_invitations {
id bigint [primary key, not null, increment]
event_id bigint [not null]
email varchar(255) [not null]
role varchar [not null]
token varchar(64) [not null]
status varchar [not null]
message text
invited_by_id bigint
user_id bigint
created_at timestamptz [default: `CURRENT_TIMESTAMP`]
accepted_at timestamptz
declined_at timestamptz
expires_at timestamptz [not null]
indexes {
expires_at
email
(event_id, status)
(event_id, email)
token
}
}
Table chat_rooms {
id bigint [primary key, not null, increment]
event_id bigint [not null]
name varchar(100) [not null]
description varchar(500)
created_at timestamptz [default: `CURRENT_TIMESTAMP`]
updated_at timestamptz
session_id bigint
room_type varchar [not null]
is_enabled boolean [not null, default: true]
display_order double [not null]
indexes {
(session_id, room_type)
}
}
Table organization_invitations {
id bigint [primary key, not null, increment]
organization_id bigint [not null]
email varchar(255) [not null]
role varchar [not null]
token varchar(64) [not null]
status varchar [not null]
message text
invited_by_id bigint
user_id bigint
created_at timestamptz [default: `CURRENT_TIMESTAMP`]
accepted_at timestamptz
declined_at timestamptz
expires_at timestamptz [not null]
indexes {
token
(organization_id, status)
(organization_id, email)
email
expires_at
}
}
Table sessions {
id bigint [primary key, not null, increment]
event_id bigint [not null]
status varchar [not null]
session_type varchar [not null]
title text [not null]
description text
start_time time [not null]
end_time time [not null]
stream_url text
day_number bigint [not null]
created_at timestamptz [default: `CURRENT_TIMESTAMP`]
updated_at timestamptz
short_description varchar(200)
chat_mode varchar [not null, default: 'ENABLED']
streaming_platform varchar(20)
zoom_meeting_id varchar(255)
zoom_passcode varchar(100)
mux_playback_policy varchar(20)
indexes {
(event_id, day_number, start_time)
}
}
Table events {
id bigint [primary key, not null, increment]
organization_id bigint [not null]
title text [not null]
description text
event_type varchar [not null]
start_date varchar [not null]
end_date varchar [not null]
company_name text [not null]
slug text [not null]
status varchar [not null]
branding varchar [not null]
hero_description text
hero_images varchar
event_format varchar [not null]
is_private boolean
venue_name varchar(255)
venue_address text
venue_city varchar(100)
venue_country varchar(100)
sections varchar
created_at timestamptz [default: `CURRENT_TIMESTAMP`]
updated_at timestamptz
icebreakers varchar
sponsor_tiers varchar
venue_state varchar
deleted_at timestamptz
deleted_by_id bigint
main_session_id bigint
timezone varchar(50) [not null, default: 'UTC']
indexes {
slug
}
}
Table event_users {
event_id bigint [primary key, not null]
user_id bigint [primary key, not null]
role varchar [not null]
speaker_bio text
speaker_title text
created_at timestamptz [default: `CURRENT_TIMESTAMP`]
privacy_overrides varchar
is_banned boolean [not null, default: false]
banned_at timestamptz
banned_by bigint
ban_reason text
is_chat_banned boolean [not null, default: false]
chat_ban_until timestamptz
chat_ban_reason text
moderation_notes text
indexes {
(event_id, is_banned, role)
(user_id, event_id)
}
}
Table users {
id bigint [primary key, not null, increment]
email text [not null]
password_hash text [not null]
first_name text [not null]
last_name text [not null]
company_name text
title text
bio text
image_url text
social_links varchar [not null]
is_active boolean [not null]
created_at timestamptz [default: `CURRENT_TIMESTAMP`]
updated_at timestamptz
email_verified boolean [not null]
privacy_settings varchar [not null, default: '{}']
indexes {
email
}
}
Table token_blocklist {
id integer [primary key, not null, increment]
jti varchar(36) [not null]
token_type varchar(10) [not null]
user_id bigint [not null]
revoked boolean [not null]
expires timestamp [not null]
indexes {
jti
}
}
Table user_key_backups {
id bigint [primary key, not null, increment]
user_id bigint [not null]
encrypted_private_key text [not null]
salt text [not null]
created_at timestamptz [default: `CURRENT_TIMESTAMP`]
indexes {
user_id
}
}
Table email_verifications {
id bigint [primary key, not null, increment]
user_id bigint [not null]
email varchar(255) [not null]
token varchar(64) [not null]
created_at timestamptz [default: `CURRENT_TIMESTAMP`]
expires_at timestamptz [not null]
verified_at timestamptz
indexes {
token
email
(token, expires_at)
(user_id, email)
}
}
Table password_resets {
id bigint [primary key, not null, increment]
user_id bigint [not null]
email varchar(255) [not null]
token varchar(64) [not null]
created_at timestamptz [default: `CURRENT_TIMESTAMP`]
expires_at timestamptz [not null]
used_at timestamptz
indexes {
(token, expires_at, used_at)
token
(user_id, token)
email
}
}
// Foreign Key Relationships
Ref: direct_message_threads.event_scope_id > events.id
Ref: direct_message_threads.user2_id > users.id
Ref: direct_message_threads.user1_id > users.id
Ref: organization_users.user_id > users.id
Ref: organization_users.organization_id > organizations.id
Ref: user_encryption_keys.user_id > users.id
Ref: direct_messages.thread_id > direct_message_threads.id
Ref: direct_messages.sender_id > users.id
Ref: connections.requester_id > users.id
Ref: connections.recipient_id > users.id
Ref: connections.originating_event_id > events.id
Ref: chat_messages.deleted_by_id > users.id
Ref: chat_messages.user_id > users.id
Ref: chat_messages.room_id > chat_rooms.id
Ref: session_speakers.user_id > users.id
Ref: session_speakers.session_id > sessions.id
Ref: sponsors.event_id > events.id
Ref: event_invitations.user_id > users.id
Ref: event_invitations.invited_by_id > users.id
Ref: event_invitations.event_id > events.id
Ref: chat_rooms.session_id > sessions.id
Ref: chat_rooms.event_id > events.id
Ref: organization_invitations.user_id > users.id
Ref: organization_invitations.organization_id > organizations.id
Ref: organization_invitations.invited_by_id > users.id
Ref: sessions.event_id > events.id
Ref: events.main_session_id > sessions.id
Ref: events.deleted_by_id > users.id
Ref: events.organization_id > organizations.id
Ref: event_users.banned_by > users.id
Ref: event_users.user_id > users.id
Ref: event_users.event_id > events.id
Ref: token_blocklist.user_id > users.id
Ref: user_key_backups.user_id > users.id
Ref: email_verifications.user_id > users.id
Ref: password_resets.user_id > users.id