Feature: Save releases (#36)

* chore: tidy deps

* refactor: database migration

* refactor: store release

* refactor: save release

* chore: add packages

* feat(web): show stats and recent releases

* refactor: simply filter struct

* feat: add eventbus

* chore: cleanup logging

* chore: update packages
This commit is contained in:
Ludvig Lundgren 2021-11-24 23:18:12 +01:00 committed by GitHub
parent d22dd2fe84
commit 7177e48c02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 5859 additions and 3328 deletions

View file

@ -138,10 +138,115 @@ CREATE TABLE action
FOREIGN KEY (client_id) REFERENCES client(id),
FOREIGN KEY (filter_id) REFERENCES filter(id)
);
CREATE TABLE "release"
(
id INTEGER PRIMARY KEY,
filter_status TEXT,
push_status TEXT,
rejections TEXT [] DEFAULT '{}' NOT NULL,
indexer TEXT,
filter TEXT,
protocol TEXT,
implementation TEXT,
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
group_id TEXT,
torrent_id TEXT,
torrent_name TEXT,
size INTEGER,
raw TEXT,
title TEXT,
category TEXT,
season INTEGER,
episode INTEGER,
year INTEGER,
resolution TEXT,
source TEXT,
codec TEXT,
container TEXT,
hdr TEXT,
audio TEXT,
release_group TEXT,
region TEXT,
language TEXT,
edition TEXT,
unrated BOOLEAN,
hybrid BOOLEAN,
proper BOOLEAN,
repack BOOLEAN,
website TEXT,
artists TEXT [] DEFAULT '{}' NOT NULL,
type TEXT,
format TEXT,
bitrate TEXT,
log_score INTEGER,
has_log BOOLEAN,
has_cue BOOLEAN,
is_scene BOOLEAN,
origin TEXT,
tags TEXT [] DEFAULT '{}' NOT NULL,
freeleech BOOLEAN,
freeleech_percent INTEGER,
uploader TEXT,
pre_time TEXT
);
`
var migrations = []string{
"",
`
CREATE TABLE "release"
(
id INTEGER PRIMARY KEY,
filter_status TEXT,
push_status TEXT,
rejections TEXT [] DEFAULT '{}' NOT NULL,
indexer TEXT,
filter TEXT,
protocol TEXT,
implementation TEXT,
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
group_id TEXT,
torrent_id TEXT,
torrent_name TEXT,
size INTEGER,
raw TEXT,
title TEXT,
category TEXT,
season INTEGER,
episode INTEGER,
year INTEGER,
resolution TEXT,
source TEXT,
codec TEXT,
container TEXT,
hdr TEXT,
audio TEXT,
release_group TEXT,
region TEXT,
language TEXT,
edition TEXT,
unrated BOOLEAN,
hybrid BOOLEAN,
proper BOOLEAN,
repack BOOLEAN,
website TEXT,
artists TEXT [] DEFAULT '{}' NOT NULL,
type TEXT,
format TEXT,
bitrate TEXT,
log_score INTEGER,
has_log BOOLEAN,
has_cue BOOLEAN,
is_scene BOOLEAN,
origin TEXT,
tags TEXT [] DEFAULT '{}' NOT NULL,
freeleech BOOLEAN,
freeleech_percent INTEGER,
uploader TEXT,
pre_time TEXT
);
`,
}
func Migrate(db *sql.DB) error {