1
+ BEGIN ;
2
+
3
+ DROP SCHEMA IF EXISTS fb CASCADE;
1
4
CREATE SCHEMA fb ;
2
5
SET search_path TO fb," $user" ,public;
3
6
CREATE EXTENSION " uuid-ossp" ;
4
7
5
8
6
- CREATE TABLE " user " (
9
+ CREATE TABLE consumer (
7
10
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
8
11
created timestamptz NOT NULL DEFAULT now(),
9
12
full_name text NOT NULL DEFAULT ' '
@@ -14,13 +17,13 @@ CREATE TABLE post (
14
17
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
15
18
created timestamptz NOT NULL DEFAULT now(),
16
19
content text NOT NULL DEFAULT ' ' ,
17
- " user " uuid REFERENCES " user " NOT NULL
20
+ consumer uuid REFERENCES consumer NOT NULL
18
21
);
19
22
20
23
21
24
CREATE TABLE friendship (
22
- first uuid REFERENCES " user " NOT NULL ,
23
- second uuid REFERENCES " user " NOT NULL ,
25
+ first uuid REFERENCES consumer NOT NULL ,
26
+ second uuid REFERENCES consumer NOT NULL ,
24
27
created timestamptz NOT NULL DEFAULT now(),
25
28
UNIQUE (first, second)
26
29
);
@@ -44,3 +47,5 @@ AFTER INSERT ON friendship
44
47
DEFERRABLE INITIALLY DEFERRED
45
48
FOR EACH ROW
46
49
EXECUTE PROCEDURE check_friendship_symmetry();
50
+
51
+ END;
0 commit comments