forked from Daniel15/rTorrentWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrtorrent.sql
92 lines (81 loc) · 2.56 KB
/
rtorrent.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
-- rTorrentWeb version 0.1 prerelease
-- $Id$
-- Copyright (C) 2009, Daniel Lo Nigro (Daniel15) <daniel at d15.biz>
--
-- This file is part of rTorrentWeb.
--
-- rTorrentWeb is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- rTorrentWeb is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with rTorrentWeb. If not, see <http://www.gnu.org/licenses/>.
CREATE TABLE roles (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
name TEXT UNIQUE NULL,
description TEXT NULL
);
INSERT INTO roles VALUES (1, 'login', 'Login privileges, granted after account confirmation');
INSERT INTO roles VALUES (2, 'admin', 'Administrative user, has access to everything.');
CREATE TABLE roles_users (
user_id INTEGER NULL,
role_id INTEGER NULL
);
CREATE TABLE settings (
variable TEXT NOT NULL PRIMARY KEY,
value TEXT NOT NULL
);
-- Increment this when the schema changes
INSERT INTO settings VALUES ('db_version', '1');
CREATE TABLE torrents (
hash TEXT NOT NULL PRIMARY KEY,
user_id INTEGER NULL,
private BOOLEAN DEFAULT '''''''0''''''' NULL
);
CREATE TABLE user_tokens (
id INTEGER NULL PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NULL,
user_agent TEXT NULL,
token TEXT UNIQUE NULL,
created INTEGER NULL,
expires INTEGER NULL
);
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT NULL,
email text UNIQUE NULL,
username text UNIQUE NOT NULL,
password text NULL,
logins INTEGER NULL,
last_login INTEGER NULL,
homedir text NOT NULL,
settings text NULL
);
CREATE INDEX key_user_id ON user_tokens (
user_id DESC
);
CREATE TABLE ext_feeds (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT ,
user_id INTEGER NOT NULL,
label_id INTEGER NOT NULL,
auto_start BOOLEAN DEFAULT '0' NOT NULL,
name TEXT NOT NULL,
url TEXT NOT NULL,
last_seen_guid TEXT NULL
);
CREATE TABLE labels (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
internal BOOLEAN DEFAULT '0' NOT NULL,
user_id INTEGER NOT NULL,
icon TEXT DEFAULT 'blank' NULL
);
CREATE TABLE labels_torrents (
torrent_hash TEXT NOT NULL,
label_id INTEGER NOT NULL
);