forked from stakwork/sphinx-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sql
118 lines (97 loc) · 2.23 KB
/
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
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
CREATE TABLE media (
id TEXT NOT NULL PRIMARY KEY,
owner_pub_key TEXT NOT NULL,
name TEXT,
description TEXT,
price BIGINT,
tags TEXT[] not null default '{}',
ttl BIGINT,
filename TEXT,
size BIGINT,
mime TEXT,
nonce TEXT,
created timestamptz,
updated timestamptz,
expiry timestamptz, -- optional permanent deletion of file
total_sats BIGINT,
total_buys BIGINT,
template boolean,
width INT,
height INT
);
ALTER TABLE media ADD COLUMN tsv tsvector;
CREATE INDEX media_tsv ON media USING GIN(tsv);
CREATE TABLE tribes (
uuid TEXT NOT NULL PRIMARY KEY,
owner_pub_key TEXT NOT NULL,
owner_alias TEXT,
group_key TEXT,
name TEXT,
description TEXT,
tags TEXT[] not null default '{}',
img TEXT,
price_to_join BIGINT,
price_per_message BIGINT,
escrow_amount BIGINT,
escrow_millis BIGINT,
created timestamptz,
updated timestamptz,
member_count BIGINT,
unlisted boolean,
private boolean,
deleted boolean,
app_url TEXT,
feed_url TEXT,
last_active BIGINT,
bots TEXT,
owner_route_hint TEXT,
unique_name TEXT,
feed_type INT,
pin TEXT,
preview TEXT,
profile_filters TEXT,
badges TEXT[] not null default '{}'
);
ALTER TABLE tribes ADD COLUMN tsv tsvector;
CREATE INDEX tribes_tsv ON tribes USING GIN(tsv);
CREATE TABLE bots (
uuid TEXT NOT NULL PRIMARY KEY,
owner_pub_key TEXT NOT NULL,
owner_alias TEXT,
name TEXT,
unique_name TEXT,
description TEXT,
tags TEXT[] not null default '{}',
img TEXT,
price_per_use BIGINT,
created timestamptz,
updated timestamptz,
member_count BIGINT,
unlisted boolean,
deleted boolean,
owner_route_hint text
);
ALTER TABLE bots ADD COLUMN tsv tsvector;
CREATE INDEX bots_tsv ON bots USING GIN(tsv);
CREATE TABLE people (
id SERIAL PRIMARY KEY,
uuid TEXT,
owner_pub_key TEXT NOT NULL,
owner_alias TEXT,
owner_route_hint TEXT,
owner_contact_key TEXT,
description TEXT,
tags TEXT[] not null default '{}',
img TEXT,
created timestamptz,
updated timestamptz,
unlisted boolean,
deleted boolean,
unique_name TEXT,
price_to_meet BIGINT,
extras JSONB,
twitter_confirmed BOOLEAN,
github_issues JSONB
);
ALTER TABLE people ADD COLUMN tsv tsvector;
CREATE INDEX people_tsv ON people USING GIN(tsv);