-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.sql
57 lines (47 loc) · 1.29 KB
/
schema.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
PRAGMA journal_mode = WAL;
create table
if not exists links (
source text primary key not null,
destination text not null,
description text,
created datetime default current_timestamp not null
);
create table
if not exists views (
id integer primary key not null,
path text not null,
ip text not null,
created datetime default current_timestamp not null
);
create virtual table if not exists links_fts using fts5 (
source,
description,
content = links,
tokenize = "porter"
);
drop trigger if exists links_ai;
drop trigger if exists links_ad;
drop trigger if exists links_au;
create trigger links_ai after insert on links begin
insert into
links_fts (rowid, source, description)
values
(new.rowid, new.source, new.description);
end;
create trigger links_ad after delete on links begin
insert into
links_fts (links_fts, rowid, source, description)
values
('delete', old.rowid, old.source, old.description);
end;
create trigger links_au after
update on links begin
insert into
links_fts (links_fts, rowid, source, description)
values
('delete', old.rowid, old.source, old.description);
insert into
links_fts (rowid, source, description)
values
(new.rowid, new.source, new.description);
end;