-
Notifications
You must be signed in to change notification settings - Fork 1
/
postgre.sql
49 lines (41 loc) · 1.23 KB
/
postgre.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
-- Database: Survey
-- DROP DATABASE IF EXISTS "Survey";
CREATE DATABASE "Survey"
WITH
OWNER = postgres
ENCODING = 'UTF8'
LC_COLLATE = 'Turkish_Turkey.1254'
LC_CTYPE = 'Turkish_Turkey.1254'
TABLESPACE = pg_default
CONNECTION LIMIT = -1
IS_TEMPLATE = False;
BEGIN;
CREATE TABLE IF NOT EXISTS public.surveys
(
token text COLLATE pg_catalog."default",
title text COLLATE pg_catalog."default",
description text COLLATE pg_catalog."default"
);
CREATE TABLE IF NOT EXISTS public.options
(
token text COLLATE pg_catalog."default",
title text COLLATE pg_catalog."default",
votes integer,
surveytoken text COLLATE pg_catalog."default"
);
CREATE TABLE IF NOT EXISTS public.users
(
token text COLLATE pg_catalog."default" NOT NULL,
username text COLLATE pg_catalog."default" NOT NULL,
email text COLLATE pg_catalog."default" NOT NULL,
password text COLLATE pg_catalog."default" NOT NULL,
perm text COLLATE pg_catalog."default" NOT NULL
);
CREATE TABLE IF NOT EXISTS public.votes
(
token text COLLATE pg_catalog."default",
optiontoken text COLLATE pg_catalog."default",
usertoken text COLLATE pg_catalog."default",
surveytoken text COLLATE pg_catalog."default"
);
END;