-- The plays of artists a person has no music of, brought in by an import: only the name of the artist and the time, -- enough to learn which artists are played in the same sitting (see internal/affinity). No title, album, IP address, -- country or platform is kept. A play that is later matched to a song of the library is left out of the learning -- (its listening event is there) and removed the next time the model is built. CREATE TABLE outside_plays ( user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE, idempotency_key TEXT NOT NULL, -- the key of the same play as a listening event, so it is told apart from it artist TEXT NOT NULL, artist_key TEXT NOT NULL, -- storage.SearchKey of the name: how it meets the artists of the library played_at INTEGER NOT NULL, -- unix seconds PRIMARY KEY (user_id, idempotency_key) ); CREATE INDEX idx_outside_plays_time ON outside_plays(user_id, played_at);