Update metadata on download finish
This commit is contained in:
@@ -62,3 +62,23 @@ CREATE INDEX parsed_torrents_state_idx
|
||||
CREATE UNIQUE INDEX parsed_torrents_info_hash_uidx
|
||||
ON parsed_torrents (info_hash)
|
||||
WHERE info_hash != '';
|
||||
|
||||
-- Albums that music-agregator has pointed tora at. One row per
|
||||
-- (album_id, quality) pair: a re-monitor of the same album at the same
|
||||
-- quality is rejected by the UNIQUE constraint until the previous row is
|
||||
-- removed. The `torrent_id` column links back to tora's torrent; it's what
|
||||
-- the startup notification subscriber uses to look up which album a
|
||||
-- STATE_CHANGED -> FINISHED event belongs to.
|
||||
CREATE TABLE monitored_albums (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
album_id TEXT NOT NULL,
|
||||
torrent_id UUID NOT NULL,
|
||||
quality TEXT NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
completed_at TIMESTAMPTZ,
|
||||
UNIQUE (album_id, quality)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX monitored_albums_torrent_id_uidx
|
||||
ON monitored_albums (torrent_id);
|
||||
|
||||
Reference in New Issue
Block a user