CREATE TABLE public.student_lifecycle_log
(
    lifecycle_log_id integer NOT NULL DEFAULT nextval('student_lifecycle_log_lifecycle_log_id_seq'::regclass),
    student_id bigint NOT NULL,
    level_id integer NOT NULL,
    previous_status text,
    new_status text,
    previous_level_id integer,
    new_level_id integer,
    previous_tutor_id bigint,
    new_tutor_id bigint,
    actor_id bigint NOT NULL,
    actor_role text NOT NULL,
    action_type text NOT NULL,
    reason text NOT NULL,
    processed_at timestamp without time zone DEFAULT now(),
    reason_id integer,
    comments text,
    CONSTRAINT fk_lifecycle_reason FOREIGN KEY (reason_id) REFERENCES promotion_reasons(reason_id) ON DELETE RESTRICT,
    CONSTRAINT pk_student_lifecycle_log PRIMARY KEY (lifecycle_log_id)
);
