CREATE TYPE media_type AS ENUM ('movie', 'show');
CREATE TYPE media_category AS ENUM ('trending', 'popular', 'anticipated', 'box_office');
CREATE TYPE media_source AS ENUM ('trakttv');

CREATE TABLE external_medias (
    id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
    type media_type NOT NULL,
    source media_source NOT NULL,
    category media_category NOT NULL,
    ids text[][] NOT NULL,
    LIKE base INCLUDING DEFAULTS
);
CREATE TRIGGER update_external_medias_updated_at BEFORE UPDATE ON external_medias FOR EACH ROW EXECUTE PROCEDURE update_updated_at_column();
CREATE INDEX ON external_medias (type, source, category);

