sonda/migrations/sqlite/0033_lidarr_requests.sql
tgiachi af933ad9ea feat(lidarr): a page of the artists I sent to Lidarr, and whether they arrived
Sonda kept no record of what an admin sent to Lidarr. Each send is now kept
(migration 0033, lidarr_requests), once for each artist, with the first date.
GET /lidarr/requests lists them newest first and says for each whether its
music is in the library: it is noticed when the list is read, by the artist
that was sent or by an artist of the same name that a scan made, and the day
it first was is kept.

The web app has a Requests page for admins, under Discover in the menu and on
Home on a phone, with the waiting and the arrived artists apart.
2026-11-15 12:32:29 +01:00

18 lines
1.1 KiB
SQL

-- The artists a person sent to their Lidarr from Sonda, so that a page can say which of them have arrived. An artist
-- has arrived when its music is in the library: Sonda notices it when the list is read and keeps the day it first did.
-- The name is kept too, because the artist of a request can be removed (an artist only a provider named) while the
-- request is still of interest.
CREATE TABLE lidarr_requests (
id INTEGER PRIMARY KEY,
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
artist_id INTEGER REFERENCES artists(id) ON DELETE SET NULL,
artist_name TEXT NOT NULL,
artist_key TEXT NOT NULL, -- storage.SearchKey of the name: how music that arrives is told to be this artist's
artist_mbid TEXT,
requested_at INTEGER NOT NULL, -- unix seconds, the first time it was sent
arrived_at INTEGER -- unix seconds, NULL while there is no music of it
);
CREATE UNIQUE INDEX idx_lidarr_requests_artist ON lidarr_requests(user_id, artist_key);
CREATE INDEX idx_lidarr_requests_time ON lidarr_requests(user_id, requested_at DESC);