-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreat_sql.txt
More file actions
132 lines (119 loc) · 4.25 KB
/
creat_sql.txt
File metadata and controls
132 lines (119 loc) · 4.25 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
create table public."Blogs" (
id uuid not null,
date character varying null,
description text null,
category character varying null,
image_url text null,
title character varying null,
content text null,
tags text null,
constraint Blogs_pkey primary key (id)
) TABLESPACE pg_default;
create table public."Chat" (
id uuid not null default gen_random_uuid (),
question text null,
answer text null,
"createdAt" timestamp with time zone not null default now(),
mode text null default 'regular'::text,
constraint Chat_pkey primary key (id)
) TABLESPACE pg_default;
create table public."Projects" (
id uuid not null default gen_random_uuid (),
title character varying null,
content character varying null,
published_at timestamp without time zone null,
updated_at timestamp without time zone null,
image_url text null,
"URL" text null,
category character varying null,
year character varying null,
technology text null,
num integer null,
constraint Projects_pkey primary key (id)
) TABLESPACE pg_default;
create table public.blog_embeddings (
id bigint generated always as identity not null,
source text null,
source_id text null,
chunk_index integer null,
content text null,
embedding public.vector null,
url text null,
constraint blog_embeddings_pkey primary key (id)
) TABLESPACE pg_default;
create index IF not exists blog_embeddings_embedding_idx on public.blog_embeddings using ivfflat (embedding vector_cosine_ops) TABLESPACE pg_default;
create table public.experience (
id serial not null,
date character varying(50) not null,
name character varying(255) not null,
subname character varying(255) not null,
text text not null,
constraint experience_pkey primary key (id)
) TABLESPACE pg_default;
create table public.life_blogs (
id serial not null,
title character varying(255) not null,
image_url character varying(255) null,
category character varying(255) null,
published_at date null,
description text null,
require_login boolean not null default false,
created_at timestamp with time zone null default CURRENT_TIMESTAMP,
updated_at timestamp with time zone null default CURRENT_TIMESTAMP,
tags character varying(255) null,
content text null,
constraint life_blogs_pkey primary key (id)
) TABLESPACE pg_default;
create table public.visitor_clicks (
id serial not null,
click_event text not null,
target_url text not null,
local_time timestamp with time zone not null default now(),
ip text null,
event text null,
ua text null,
country text null,
region text null,
city text null,
latitude double precision null,
longitude double precision null,
created_at timestamp with time zone null default now(),
constraint visitor_clicks_pkey primary key (id)
) TABLESPACE pg_default;
create table public.visitor_logs (
id bigint generated by default as identity not null,
ip text not null,
local_time timestamp with time zone not null default now(),
event text null,
ua text null,
country text null,
region text null,
city text null,
latitude double precision null,
longitude double precision null,
created_at timestamp with time zone null default now(),
constraint visitor_logs_pkey primary key (id)
) TABLESPACE pg_default;
create table public.blog_comments (
id uuid not null default gen_random_uuid (),
blog_id text not null,
blog_type text not null,
author_name text not null,
author_email text not null,
content text not null,
parent_id uuid null,
is_approved boolean not null default true,
created_at timestamp with time zone not null default now(),
updated_at timestamp with time zone null default now(),
constraint blog_comments_pkey primary key (id),
constraint blog_comments_parent_fkey foreign key (parent_id) references public.blog_comments(id) on delete cascade
) TABLESPACE pg_default;
create index IF not exists blog_comments_blog_idx on public.blog_comments (blog_id, blog_type);
create index IF not exists blog_comments_parent_idx on public.blog_comments (parent_id);
alter table public.blog_comments enable row level security;
create policy "Anyone can read approved comments"
on public.blog_comments for select
using (is_approved = true);
create policy "Anyone can insert comments"
on public.blog_comments for insert
with check (true);