-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path20230712074829_init.sql
49 lines (44 loc) · 1.57 KB
/
20230712074829_init.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
create type partner_type as enum ('technology', 'expert');
create table partner_contacts (
id bigint generated by default as identity primary key,
type partner_type not null,
company text not null,
country text not null,
details text,
email text not null unique,
first text not null,
last text not null,
phone text,
size int,
title text,
website text not null,
created_at timestamp with time zone default timezone('utc'::text, now()) not null
);
alter table partner_contacts enable row level security;
create policy "Enable public insert" on partner_contacts for insert with check (true);
create table partners (
id bigint generated by default as identity primary key,
slug text not null unique,
type partner_type not null,
category text not null,
developer text not null,
title text not null,
description text not null,
logo text not null,
images text[],
overview text not null,
website text not null,
docs text not null,
contact bigint references partner_contacts not null,
approved boolean default false,
created_at timestamp with time zone default timezone('utc'::text, now()) not null,
tsv tsvector generated always as (
setweight(to_tsvector('english', title), 'A')
|| setweight(to_tsvector('english', description), 'B')
|| setweight(to_tsvector('english', overview), 'C')
|| setweight(to_tsvector('english', category), 'D')
|| setweight(to_tsvector('english', slug), 'D')
) stored
);
alter table partners enable row level security;
create policy "Enable public read access" on partners for select using (true);