-
Notifications
You must be signed in to change notification settings - Fork 0
/
Postgres.sql
63 lines (49 loc) · 2.93 KB
/
Postgres.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
CREATE TABLE public.client_center (
id varchar(36) GENERATED ALWAYS AS (((json ->> 'id'::text))) STORED NOT NULL,
"name" varchar(256) GENERATED ALWAYS AS (((json ->> 'name'::text))) STORED NOT NULL,
"json" jsonb NOT NULL,
updatedat int8 GENERATED ALWAYS AS ((json ->> 'updatedAt'::text)::bigint) STORED NOT NULL,
updatedby varchar(256) GENERATED ALWAYS AS (((json ->> 'updatedBy'::text))) STORED NOT NULL,
deleted bool GENERATED ALWAYS AS ((json ->> 'deleted'::text)::boolean) STORED NULL,
namehash varchar(256) NOT NULL,
CONSTRAINT client_center_namehash_key UNIQUE (namehash),
CONSTRAINT client_center_pkey PRIMARY KEY (id)
);
CREATE INDEX idx_name_client_center ON public.client_center USING btree (name);
CREATE TABLE public.knowledge_center (
id varchar(36) GENERATED ALWAYS AS (((json ->> 'id'::text))) STORED NOT NULL,
"name" varchar(256) GENERATED ALWAYS AS (((json ->> 'name'::text))) STORED NOT NULL,
"json" jsonb NOT NULL,
updatedat int8 GENERATED ALWAYS AS ((json ->> 'updatedAt'::text)::bigint) STORED NOT NULL,
updatedby varchar(256) GENERATED ALWAYS AS (((json ->> 'updatedBy'::text))) STORED NOT NULL,
deleted bool GENERATED ALWAYS AS ((json ->> 'deleted'::text)::boolean) STORED NULL,
namehash varchar(256) NOT NULL,
CONSTRAINT knowledge_center_namehash_key UNIQUE (namehash),
CONSTRAINT knowledge_center_pkey PRIMARY KEY (id)
);
CREATE INDEX idx_name_knowledge_center ON public.knowledge_center USING btree (name);
CREATE TABLE public.client_center_client (
id varchar(36) GENERATED ALWAYS AS (((json ->> 'id'::text))) STORED NOT NULL,
"json" jsonb NOT NULL,
updatedat int8 GENERATED ALWAYS AS ((json ->> 'updatedAt'::text)::bigint) STORED NOT NULL,
updatedby varchar(256) GENERATED ALWAYS AS (((json ->> 'updatedBy'::text))) STORED NOT NULL,
deleted bool GENERATED ALWAYS AS ((json ->> 'deleted'::text)::boolean) STORED NULL,
fqnhash varchar(768) NOT NULL,
"name" varchar(256) GENERATED ALWAYS AS (((json ->> 'name'::text))) STORED NOT NULL,
CONSTRAINT client_center_client_fqnhash_key UNIQUE (fqnhash),
CONSTRAINT client_center_client_pkey PRIMARY KEY (id)
);
CREATE INDEX idx_name_client_center_client ON public.client_center_client USING btree (name);
CREATE TABLE public.knowledge_center_document (
id varchar(36) GENERATED ALWAYS AS (((json ->> 'id'::text))) STORED NOT NULL,
"json" jsonb NOT NULL,
updatedat int8 GENERATED ALWAYS AS ((json ->> 'updatedAt'::text)::bigint) STORED NOT NULL,
updatedby varchar(256) GENERATED ALWAYS AS (((json ->> 'updatedBy'::text))) STORED NOT NULL,
deleted bool GENERATED ALWAYS AS ((json ->> 'deleted'::text)::boolean) STORED NULL,
fqnhash varchar(768) NOT NULL,
"name" varchar(256) GENERATED ALWAYS AS (((json ->> 'name'::text))) STORED NOT NULL,
CONSTRAINT knowledge_center_document_fqnhash_key UNIQUE (fqnhash),
CONSTRAINT knowledge_center_document_pkey PRIMARY KEY (id)
);
CREATE INDEX idx_name_knowledge_center_document ON public.knowledge_center_document USING btree (name);
------------