-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinit.sql
More file actions
42 lines (36 loc) · 1.3 KB
/
Copy pathinit.sql
File metadata and controls
42 lines (36 loc) · 1.3 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
create table if not exists keys (
key_id integer primary key,
key text unique,
length integer not null,
create_time integer not null default (cast(unixepoch('subsec')*1e3 as integer)),
last_used integer not null default (cast(unixepoch('subsec')*1e3 as integer)),
access_count integer not null default 0
) strict;
create table if not exists "values" (
value_id integer not null references keys(key_id) on delete cascade,
offset integer not null,
blob_id integer not null unique,
primary key (value_id, offset)
) strict;
create table if not exists blobs (
blob_id integer not null primary key
references "values"(blob_id) on delete cascade
-- This lets us create the blob first, then attach it to "values".
deferrable initially deferred,
blob blob not null
) strict;
create table if not exists cache_meta (
key text primary key,
value
) without rowid;
create index if not exists blob_last_used on keys(last_used, access_count, create_time, key_id);
create table if not exists setting (
name primary key on conflict replace,
value
) without rowid;
create table if not exists tags (
key_id integer references keys(key_id) on delete cascade,
tag_name any,
value any,
primary key (key_id, tag_name)
) strict, without rowid;