-
Notifications
You must be signed in to change notification settings - Fork 0
/
builddb.sql
78 lines (66 loc) · 2.49 KB
/
builddb.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
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
GRANT ALL ON SCHEMA public TO testing;
GRANT ALL ON SCHEMA public TO PUBLIC;
--DROP DATABASE "CurbMapUsers";
GRANT ALL ON DATABASE "CurbMapUsers" TO testing;
GRANT TEMPORARY, CONNECT ON DATABASE "CurbMapUsers" TO PUBLIC;
CREATE TABLE public.lines
(
userid character varying(255) COLLATE pg_catalog."default" NOT NULL,
"createdAt" timestamp without time zone NOT NULL,
"updatedAt" timestamp without time zone NOT NULL,
lines_created jsonb,
CONSTRAINT "useridPK" PRIMARY KEY (userid)
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public.lines
OWNER to testing;
GRANT ALL ON TABLE public.lines TO testing;
CREATE TABLE public.photos
(
userid character varying(255) COLLATE pg_catalog."default" NOT NULL,
"createdAt" timestamp without time zone NOT NULL,
"updatedAt" timestamp without time zone NOT NULL,
photos_created jsonb,
CONSTRAINT photos_pkey PRIMARY KEY (userid)
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public.photos
OWNER to testing;
GRANT ALL ON TABLE public.photos TO testing;
CREATE TABLE public.standard_user
(
id_user character varying(255) COLLATE pg_catalog."default" NOT NULL,
active_account integer NOT NULL,
auth_token character varying(255) COLLATE pg_catalog."default",
authorized integer NOT NULL,
date_created timestamp without time zone NOT NULL,
external_auth_key character varying(255) COLLATE pg_catalog."default",
external_auth_service character varying(255) COLLATE pg_catalog."default",
password_hash character varying(255) COLLATE pg_catalog."default" NOT NULL,
role character varying(255) COLLATE pg_catalog."default" NOT NULL,
user_email character varying(255) COLLATE pg_catalog."default" NOT NULL,
username character varying(255) COLLATE pg_catalog."default" NOT NULL,
external_auth_id character varying(64) COLLATE pg_catalog."default",
"updatedAt" timestamp without time zone DEFAULT now(),
"createdAt" timestamp without time zone DEFAULT now(),
"badge_updatedAt" timestamp without time zone,
score bigint,
"score_updatedAt" timestamp without time zone,
badge BOOLEAN[] DEFAULT '{FALSE}'::BOOLEAN[],
CONSTRAINT standard_user_pkey PRIMARY KEY (id_user),
CONSTRAINT uk_ari93f4i6r669u3vvtno4ni9p UNIQUE (user_email),
CONSTRAINT uk_ow3udbl7wpnfa58r7vpw3kp97 UNIQUE (username)
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public.standard_user
OWNER to testing;
GRANT ALL ON TABLE public.standard_user TO testing;