-
Notifications
You must be signed in to change notification settings - Fork 0
/
create tables.txt
36 lines (31 loc) · 1.01 KB
/
create tables.txt
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
-- This script was generated by the ERD tool in pgAdmin 4.
-- Please log an issue at https://redmine.postgresql.org/projects/pgadmin4/issues/new if you find any bugs, including reproduction steps.
BEGIN;
CREATE TABLE IF NOT EXISTS public.diaryuser
(
id serial NOT NULL,
groupid integer NOT NULL,
login character varying(30) NOT NULL,
password character varying(40) NOT NULL,
phone character(25) NOT NULL,
birthday date NOT NULL,
firstname character varying(40) NOT NULL,
lastname character varying(40) NOT NULL,
middlename character(40) NOT NULL,
cookie text NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS public.vkuser
(
id serial NOT NULL,
diaryid integer NOT NULL,
vkid integer NOT NULL,
PRIMARY KEY (id)
);
ALTER TABLE IF EXISTS public.vkuser
ADD CONSTRAINT "vkUser_diaryUser" FOREIGN KEY (diaryid)
REFERENCES public.diaryuser (id) MATCH SIMPLE
ON UPDATE CASCADE
ON DELETE CASCADE
NOT VALID;
END;