-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
292 lines (208 loc) · 7.1 KB
/
schema.sql
File metadata and controls
292 lines (208 loc) · 7.1 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
--
-- PostgreSQL database dump
--
-- Dumped from database version 16.8
-- Dumped by pg_dump version 16.9 (Ubuntu 16.9-0ubuntu0.24.04.1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: Priority; Type: TYPE; Schema: public; Owner: tday
--
CREATE TYPE public."Priority" AS ENUM (
'Low',
'Medium',
'High'
);
ALTER TYPE public."Priority" OWNER TO tday;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: Account; Type: TABLE; Schema: public; Owner: tday
--
CREATE TABLE public."Account" (
"userId" text NOT NULL,
type text NOT NULL,
provider text NOT NULL,
"providerAccountId" text NOT NULL,
refresh_token text,
access_token text,
expires_at integer,
token_type text,
scope text,
id_token text,
session_state text,
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
"updatedAt" timestamp(3) without time zone NOT NULL
);
ALTER TABLE public."Account" OWNER TO tday;
--
-- Name: File; Type: TABLE; Schema: public; Owner: tday
--
CREATE TABLE public."File" (
id text NOT NULL,
name text NOT NULL,
url text NOT NULL,
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
"userID" text NOT NULL,
size integer NOT NULL,
"s3Key" text NOT NULL
);
ALTER TABLE public."File" OWNER TO tday;
--
-- Name: Note; Type: TABLE; Schema: public; Owner: tday
--
CREATE TABLE public."Note" (
id text NOT NULL,
name text NOT NULL,
content text,
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
"userID" text NOT NULL
);
ALTER TABLE public."Note" OWNER TO tday;
--
-- Name: Todo; Type: TABLE; Schema: public; Owner: tday
--
CREATE TABLE public."Todo" (
id text NOT NULL,
title text NOT NULL,
description text,
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
"userID" text NOT NULL,
pinned boolean DEFAULT false NOT NULL,
completed boolean DEFAULT false NOT NULL,
"order" integer NOT NULL,
priority public."Priority" DEFAULT 'Low'::public."Priority" NOT NULL,
"expiresAt" timestamp(3) without time zone DEFAULT ((date_trunc('day'::text, CURRENT_TIMESTAMP) + '23:00:00'::interval) + '00:59:00'::interval) NOT NULL,
"startedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);
ALTER TABLE public."Todo" OWNER TO tday;
--
-- Name: Todo_order_seq; Type: SEQUENCE; Schema: public; Owner: tday
--
CREATE SEQUENCE public."Todo_order_seq"
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public."Todo_order_seq" OWNER TO tday;
--
-- Name: Todo_order_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: tday
--
ALTER SEQUENCE public."Todo_order_seq" OWNED BY public."Todo"."order";
--
-- Name: User; Type: TABLE; Schema: public; Owner: tday
--
CREATE TABLE public."User" (
id text NOT NULL,
email text NOT NULL,
"emailVerified" timestamp(3) without time zone,
image text,
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
"updatedAt" timestamp(3) without time zone NOT NULL,
password text,
name text,
"maxStorage" numeric(65,30) DEFAULT 1000000.0 NOT NULL,
"usedStoraged" numeric(65,30) DEFAULT 0.0 NOT NULL,
"enableEncryption" boolean DEFAULT true NOT NULL,
"protectedSymmetricKey" text
);
ALTER TABLE public."User" OWNER TO tday;
--
-- Name: VerificationToken; Type: TABLE; Schema: public; Owner: tday
--
CREATE TABLE public."VerificationToken" (
identifier text NOT NULL,
token text NOT NULL,
expires timestamp(3) without time zone NOT NULL
);
ALTER TABLE public."VerificationToken" OWNER TO tday;
--
-- Name: _prisma_migrations; Type: TABLE; Schema: public; Owner: tday
--
CREATE TABLE public._prisma_migrations (
id character varying(36) NOT NULL,
checksum character varying(64) NOT NULL,
finished_at timestamp with time zone,
migration_name character varying(255) NOT NULL,
logs text,
rolled_back_at timestamp with time zone,
started_at timestamp with time zone DEFAULT now() NOT NULL,
applied_steps_count integer DEFAULT 0 NOT NULL
);
ALTER TABLE public._prisma_migrations OWNER TO tday;
--
-- Name: Todo order; Type: DEFAULT; Schema: public; Owner: tday
--
ALTER TABLE ONLY public."Todo" ALTER COLUMN "order" SET DEFAULT nextval('public."Todo_order_seq"'::regclass);
--
-- Name: Account Account_pkey; Type: CONSTRAINT; Schema: public; Owner: tday
--
ALTER TABLE ONLY public."Account"
ADD CONSTRAINT "Account_pkey" PRIMARY KEY (provider, "providerAccountId");
--
-- Name: File File_pkey; Type: CONSTRAINT; Schema: public; Owner: tday
--
ALTER TABLE ONLY public."File"
ADD CONSTRAINT "File_pkey" PRIMARY KEY (id);
--
-- Name: Note Note_pkey; Type: CONSTRAINT; Schema: public; Owner: tday
--
ALTER TABLE ONLY public."Note"
ADD CONSTRAINT "Note_pkey" PRIMARY KEY (id);
--
-- Name: Todo Todo_pkey; Type: CONSTRAINT; Schema: public; Owner: tday
--
ALTER TABLE ONLY public."Todo"
ADD CONSTRAINT "Todo_pkey" PRIMARY KEY (id);
--
-- Name: User User_pkey; Type: CONSTRAINT; Schema: public; Owner: tday
--
ALTER TABLE ONLY public."User"
ADD CONSTRAINT "User_pkey" PRIMARY KEY (id);
--
-- Name: VerificationToken VerificationToken_pkey; Type: CONSTRAINT; Schema: public; Owner: tday
--
ALTER TABLE ONLY public."VerificationToken"
ADD CONSTRAINT "VerificationToken_pkey" PRIMARY KEY (identifier, token);
--
-- Name: _prisma_migrations _prisma_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: tday
--
ALTER TABLE ONLY public._prisma_migrations
ADD CONSTRAINT _prisma_migrations_pkey PRIMARY KEY (id);
--
-- Name: User_email_key; Type: INDEX; Schema: public; Owner: tday
--
CREATE UNIQUE INDEX "User_email_key" ON public."User" USING btree (email);
--
-- Name: Account Account_userId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: tday
--
ALTER TABLE ONLY public."Account"
ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES public."User"(id) ON UPDATE CASCADE ON DELETE CASCADE;
--
-- Name: File File_userID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: tday
--
ALTER TABLE ONLY public."File"
ADD CONSTRAINT "File_userID_fkey" FOREIGN KEY ("userID") REFERENCES public."User"(id) ON UPDATE CASCADE ON DELETE RESTRICT;
--
-- Name: Note Note_userID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: tday
--
ALTER TABLE ONLY public."Note"
ADD CONSTRAINT "Note_userID_fkey" FOREIGN KEY ("userID") REFERENCES public."User"(id) ON UPDATE CASCADE ON DELETE RESTRICT;
--
-- Name: Todo Todo_userID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: tday
--
ALTER TABLE ONLY public."Todo"
ADD CONSTRAINT "Todo_userID_fkey" FOREIGN KEY ("userID") REFERENCES public."User"(id) ON UPDATE CASCADE ON DELETE RESTRICT;
--
-- PostgreSQL database dump complete
--