Append-only event log for reconstructing a design plan timeline and auditing changes.
| Name | Type | Default | Nullable | Children | Parents | Comment |
|---|---|---|---|---|---|---|
| actor_user_id | uuid | true | public.users | User who caused the event, or NULL for system-generated events. | ||
| course_designer_plan_id | uuid | false | public.course_designer_plans | The plan this event belongs to. | ||
| created_at | timestamp with time zone | now() | false | Timestamp when the record was created. | ||
| deleted_at | timestamp with time zone | true | Timestamp when the record was deleted. If null, the record is not deleted. | |||
| event_type | varchar(255) | false | Application-defined event type identifier. | |||
| id | uuid | uuid_generate_v4() | false | A unique, stable identifier for the record. | ||
| occurred_at | timestamp with time zone | now() | false | When the event occurred. May differ from created_at when backfilling events. | ||
| payload | jsonb | ‘{}’::jsonb | false | Event-specific structured data used to reconstruct timeline details. | ||
| stage | course_designer_stage | true | Optional workflow stage associated with the event. | |||
| updated_at | timestamp with time zone | now() | false | Timestamp when the record was last updated. The field is updated automatically by the set_timestamp trigger. |
| Name | Type | Definition |
|---|---|---|
| course_designer_plan_events_actor_user_id_fkey | FOREIGN KEY | FOREIGN KEY (actor_user_id) REFERENCES users(id) |
| course_designer_plan_events_course_designer_plan_id_fkey | FOREIGN KEY | FOREIGN KEY (course_designer_plan_id) REFERENCES course_designer_plans(id) |
| course_designer_plan_events_course_designer_plan_id_not_null | n | NOT NULL course_designer_plan_id |
| course_designer_plan_events_created_at_not_null | n | NOT NULL created_at |
| course_designer_plan_events_event_type_check | CHECK | CHECK ((TRIM(BOTH FROM event_type) <> ’’::text)) |
| course_designer_plan_events_event_type_not_null | n | NOT NULL event_type |
| course_designer_plan_events_id_not_null | n | NOT NULL id |
| course_designer_plan_events_occurred_at_not_null | n | NOT NULL occurred_at |
| course_designer_plan_events_payload_not_null | n | NOT NULL payload |
| course_designer_plan_events_pkey | PRIMARY KEY | PRIMARY KEY (id) |
| course_designer_plan_events_updated_at_not_null | n | NOT NULL updated_at |
| Name | Definition |
|---|---|
| course_designer_plan_events_pkey | CREATE UNIQUE INDEX course_designer_plan_events_pkey ON public.course_designer_plan_events USING btree (id) |
| course_designer_plan_events_timeline_idx | CREATE INDEX course_designer_plan_events_timeline_idx ON public.course_designer_plan_events USING btree (course_designer_plan_id, deleted_at, occurred_at DESC) |
| Name | Definition |
|---|---|
| set_timestamp | CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.course_designer_plan_events FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp() |
Generated by tbls