CREATE TABLE public.course_reminder_rules
(
    id integer NOT NULL DEFAULT nextval('course_reminder_rules_id_seq'::regclass),
    course_id integer NOT NULL,
    name text NOT NULL,
    target_role text NOT NULL,
    cron_schedule text NOT NULL,
    template_key text NOT NULL,
    active boolean NOT NULL DEFAULT true,
    created_at timestamp with time zone NOT NULL DEFAULT now(),
    CONSTRAINT course_reminder_rules_target_role_check CHECK (target_role = ANY (ARRAY['TUTOR'::text, 'STUDENT'::text, 'PROFESSOR'::text])),
    CONSTRAINT course_reminder_rules_course_id_fkey FOREIGN KEY (course_id) REFERENCES courses(course_id),
    CONSTRAINT course_reminder_rules_pkey PRIMARY KEY (id)
);
