-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
102 lines (91 loc) · 2.85 KB
/
schema.sql
File metadata and controls
102 lines (91 loc) · 2.85 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
create table site (
id uuid primary key,
name text unique,
display_name text,
discord_guild text
);
create table article (
id uuid primary key,
site_id uuid references site on delete cascade,
slug text,
title text,
source text,
unique(site_id, slug)
);
create table account (
id uuid primary key,
number bigint unique,
google_id text unique,
discord_id text references discord_user on delete set null,
name text,
email text,
email_verified boolean,
avatar text,
created_at timestamptz
);
create table discord_user (
id text primary key,
username text,
discriminator text,
avatar text,
mfa_enabled boolean,
locale text,
email text,
email_verified boolean,
access_token text,
refresh_token text,
first_auth_at timestamptz,
last_auth_at timestamptz
);
create table discord_guild (
id text primary key,
name text,
icon text
);
create table discord_member (
user_id text references discord_user on delete cascade,
guild_id text references discord_guild on delete cascade,
primary key(user_id, guild_id)
);
create table session (
id uuid primary key,
token text unique,
address text,
user_agent text,
account_id uuid references account on delete set null,
discord_id text references discord_user on delete set null,
created_at timestamptz
);
create table discord_state (
id uuid primary key,
session_id uuid references session on delete cascade,
token text unique,
action text,
value text,
created_at timestamptz
);
create table auth_state (
id uuid primary key,
session_id uuid references session on delete cascade,
token text unique,
redirect text,
created_at timestamptz
);
create table article_view (
id uuid primary key,
session_id uuid references session on delete cascade,
article_id uuid references article on delete cascade,
created_at timestamptz
);
create table gitea_code (
id uuid primary key,
account_id uuid references account on delete cascade,
code text unique,
created_at timestamptz
);
create table gitea_token (
id uuid primary key,
account_id uuid references account on delete cascade,
token text unique,
created_at timestamptz
);