
CREATE TABLE media_metadata (
    id UUID PRIMARY KEY,
    media_id UUID NOT NULL REFERENCES media (id) ON DELETE CASCADE,
    source TEXT NOT NULL,
    tag_name TEXT NOT NULL,
    tag_value TEXT NOT NULL
);

CREATE INDEX idx_media_metadata_media_id ON media_metadata (media_id);
CREATE INDEX idx_media_metadata_tag_name_value ON media_metadata (tag_name, tag_value);