-- What is known about the picture of an album (and, later, an artist). The picture -- itself is a file in the data folder; this row says whether one was found, where it -- came from, and when the files were last searched, so a search that found nothing -- is not repeated at every request. -- -- Nothing points at the albums table on purpose. When a file of an album changes, the -- code that saves it marks the row 'stale' and bumps gen; a build that started before -- the change is not saved over it. CREATE TABLE images ( kind TEXT NOT NULL, -- 'album' owner_id BIGINT NOT NULL, status TEXT NOT NULL CHECK (status IN ('ok', 'none', 'stale')), source TEXT NOT NULL DEFAULT '', -- 'embedded', 'folder' etag TEXT NOT NULL DEFAULT '', width INTEGER NOT NULL DEFAULT 0, -- of the original height INTEGER NOT NULL DEFAULT 0, checked_at BIGINT NOT NULL, -- unix seconds gen BIGINT NOT NULL DEFAULT 0, -- counts the changes of the owner's files since the record was made PRIMARY KEY (kind, owner_id) );