-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sql
36 lines (22 loc) · 874 Bytes
/
init.sql
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
CREATE TABLE public.app_user (
id uuid NOT NULL,
username text NOT NULL,
email text NOT NULL,
password text NOT NULL
);
ALTER TABLE public.app_user OWNER TO postgres;
CREATE TABLE public.user_session (
id text NOT NULL,
user_id uuid NOT NULL,
created_at timestamp without time zone DEFAULT now() NOT NULL,
expires_at timestamp without time zone NOT NULL
);
ALTER TABLE public.user_session OWNER TO postgres;
ALTER TABLE ONLY public.app_user
ADD CONSTRAINT app_user_email_key UNIQUE (email);
ALTER TABLE ONLY public.app_user
ADD CONSTRAINT app_user_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.user_session
ADD CONSTRAINT user_session_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.user_session
ADD CONSTRAINT user_session_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.app_user(id) ON DELETE CASCADE;