schema: Playlist tags may be null, indicating "match nothing"

This is intended for partially-entered playlist data where tags have not been specified yet.
pull/401/head
Mike Lang 3 months ago committed by Mike Lang
parent 73eaac16f3
commit 8dd6741ee9

@ -110,7 +110,7 @@ class PlaylistManager(object):
[tag.lower() for tag in row.tags],
row.first_event_id,
row.last_event_id,
) for row in query(conn, "SELECT playlist_id, tags, first_event_id, last_event_id FROM playlists")
) for row in query(conn, "SELECT playlist_id, tags, first_event_id, last_event_id FROM playlists WHERE tags IS NOT NULL")
}
self.dbmanager.put_conn(conn)
duplicates = set(playlists) & set(self.static_playlists)

@ -142,11 +142,12 @@ CREATE TABLE editors (
);
-- Playlists are communicated to playlist manager via this table.
-- Sheetsync will wipe and re-populate this table periodically to match what is in the sheet
CREATE TABLE playlists (
playlist_id TEXT PRIMARY KEY,
name TEXT NOT NULL,
tags TEXT[] NOT NULL,
-- When tags is NULL, it indicates tags have not been set and so the playlist should
-- match nothing. Conversely, when tags is empty, it indicates the playlist should match everything.
tags TEXT[],
first_event_id UUID REFERENCES events(id) ON DELETE SET NULL,
last_event_id UUID REFERENCES events(id) ON DELETE SET NULL,
show_in_description BOOLEAN NOT NULL

@ -303,7 +303,7 @@ def update_row(ident, editor=None):
playlists = database.query(conn, """
SELECT playlist_id, name, tags
FROM playlists
WHERE show_in_description
WHERE show_in_description AND tags IS NOT NULL
""")
# Filter for matching playlists for this video
playlists = [

Loading…
Cancel
Save