-
Notifications
You must be signed in to change notification settings - Fork 0
/
db_schema.sql
70 lines (62 loc) · 1.7 KB
/
db_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
58
59
60
61
62
63
64
65
66
67
68
69
70
create table chunk
(
id TEXT not null
constraint chunk_pk
primary key,
item_id TEXT not null,
position INTEGER not null,
file_server_id TEXT
constraint chunk_file_server_fk
references file_server,
file_path TEXT not null,
size INTEGER not null,
created INTEGER,
modified INTEGER
);
------------------------------------------
create table container
(
id TEXT not null
constraint container_pk
primary key,
name TEXT not null,
description TEXT not null,
parent_id TEXT not null
constraint container_container_id_fk
references container,
created INTEGER,
modified INTEGER
);
create unique index container_parent_id_name_uindex
on container (parent_id, name);
------------------------------------------
create table file_server
(
id TEXT not null
constraint file_server_pk
primary key,
name TEXT not null,
params TEXT,
type integer TEXT not null,
created INTEGER,
modified INTEGER,
status TEXT,
total_space INTEGER not null,
used_space INTEGER default 0 not null
);
create unique index file_server_name_uindex
on file_server (name);
------------------------------------------
create table item
(
id TEXT not null
constraint item_pk
primary key,
name TEXT not null,
container_id TEXT not null,
chunk_count INTEGER,
status TEXT,
size INTEGER,
created INTEGER,
modified INTEGER
);