mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 16:59:12 +00:00
fix(filters): max downloads per filter check (#660)
This commit is contained in:
parent
05edb7c7a7
commit
21c02dfab0
6 changed files with 104 additions and 19 deletions
|
@ -247,17 +247,28 @@ CREATE TABLE release_action_status
|
|||
type TEXT NOT NULL,
|
||||
client TEXT,
|
||||
filter TEXT,
|
||||
filter_id INTEGER
|
||||
CONSTRAINT release_action_status_filter_id_fk
|
||||
REFERENCES filter,
|
||||
rejections TEXT [] DEFAULT '{}' NOT NULL,
|
||||
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
raw TEXT,
|
||||
log TEXT,
|
||||
release_id INTEGER NOT NULL,
|
||||
FOREIGN KEY (release_id) REFERENCES "release"(id) ON DELETE CASCADE
|
||||
release_id INTEGER NOT NULL
|
||||
CONSTRAINT release_action_status_release_id_fkey
|
||||
REFERENCES "release"
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX release_action_status_status_index
|
||||
ON release_action_status (status);
|
||||
|
||||
CREATE INDEX release_action_status_release_id_index
|
||||
ON release_action_status (release_id);
|
||||
|
||||
CREATE INDEX release_action_status_filter_id_index
|
||||
ON release_action_status (filter_id);
|
||||
|
||||
CREATE TABLE notification
|
||||
(
|
||||
id INTEGER PRIMARY KEY,
|
||||
|
@ -975,4 +986,58 @@ ALTER TABLE irc_network_dg_tmp
|
|||
ALTER TABLE "filter"
|
||||
ADD COLUMN except_language TEXT [] DEFAULT '{}';
|
||||
`,
|
||||
`CREATE TABLE release_action_status_dg_tmp
|
||||
(
|
||||
id INTEGER
|
||||
PRIMARY KEY,
|
||||
status TEXT,
|
||||
action TEXT NOT NULL,
|
||||
type TEXT NOT NULL,
|
||||
rejections TEXT DEFAULT '{}' NOT NULL,
|
||||
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
raw TEXT,
|
||||
log TEXT,
|
||||
release_id INTEGER NOT NULL
|
||||
constraint release_action_status_release_id_fkey
|
||||
references "release"
|
||||
on delete cascade,
|
||||
client TEXT,
|
||||
filter TEXT,
|
||||
filter_id INTEGER
|
||||
CONSTRAINT release_action_status_filter_id_fk
|
||||
REFERENCES filter
|
||||
);
|
||||
|
||||
INSERT INTO release_action_status_dg_tmp(id, status, action, type, rejections, timestamp, raw, log, release_id, client, filter)
|
||||
SELECT id,
|
||||
status,
|
||||
action,
|
||||
type,
|
||||
rejections,
|
||||
timestamp,
|
||||
raw,
|
||||
log,
|
||||
release_id,
|
||||
client,
|
||||
filter
|
||||
FROM release_action_status;
|
||||
|
||||
DROP TABLE release_action_status;
|
||||
|
||||
ALTER TABLE release_action_status_dg_tmp
|
||||
RENAME TO release_action_status;
|
||||
|
||||
CREATE INDEX release_action_status_filter_id_index
|
||||
ON release_action_status (filter_id);
|
||||
|
||||
CREATE INDEX release_action_status_release_id_index
|
||||
ON release_action_status (release_id);
|
||||
|
||||
CREATE INDEX release_action_status_status_index
|
||||
ON release_action_status (status);
|
||||
|
||||
UPDATE release_action_status
|
||||
SET filter_id = (SELECT f.id
|
||||
FROM filter f WHERE f.name = release_action_status.filter);
|
||||
`,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue