-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.sql
99 lines (87 loc) · 2.13 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
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
create table archive_log
(
id int auto_increment
primary key,
url text not null,
user varchar(128) not null,
status text not null,
timestamp text null
);
create table archive_queue
(
id int auto_increment
primary key,
url text null,
mode int null
);
create table archive_queue_auth
(
id int auto_increment
primary key,
token varchar(128) null
);
create table archive_worker_auth
(
id int auto_increment
primary key,
token varchar(128) not null
);
create index archive_worker_auth_token
on archive_worker_auth (token);
create table channels
(
channel_id varchar(255) not null
primary key,
channel_name text not null,
romanized_name text null,
description text null
);
create table files
(
video_id varchar(255) not null
primary key,
size_mb float null,
extension varchar(32) null
);
create table kv
(
DATA varchar(255) not null
primary key,
REFERENCE varchar(255) null
);
create table songs
(
video_id varchar(255) not null,
title text not null,
channel_name text not null,
channel_id varchar(255) not null,
upload_date text not null,
description text not null,
id int auto_increment
primary key
);
create table romanized
(
id int auto_increment
primary key,
video_id varchar(255) not null,
romanized_title text not null,
constraint video_id_exists
foreign key (video_id) references songs (video_id)
on delete cascade
);
create index idx_songs_on_channel_id
on songs (channel_id);
create index idx_songs_on_video_id
on songs (video_id);
create table worker_status
(
id int not null
primary key,
name text null,
token varchar(128) null,
status text null,
timestamp text null,
constraint valid_worker
foreign key (token) references archive_worker_auth (token)
);