Index

public.credit_registration_admin_actions

Description

One row per manual action on the credit registration pipeline, written in the same transaction as the effect. Separate from credit_registration_events because this is a global, actor-ordered read with a before/after pair and targets that are not registrations at all: a phase, a course module, a student-number link.

Columns

Name Type Default Nullable Children Parents Comment
action credit_registration_admin_action false Which action was taken.
actor_course_id uuid true public.courses The course whose edit permission authorised a teacher action, so “a teacher retried 40 items on a course they no longer teach” is answerable. NULL for global admin actions.
actor_role varchar(32) false Whether the actor acted as global_admin or as course_teacher. The same action can arrive from either, and “was this done by staff on their own course, or by us?” is the first audit question.
actor_user_id uuid false public.users Who took the action.
affected_row_count integer true Blast radius of a bulk action such as retrying every failed item on a course.
after_state credit_registration_state true Ledger state after the action, for item-targeted actions.
before_state credit_registration_state true Ledger state before the action, for item-targeted actions.
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.
details jsonb true Freeform context for the action, scrubbed before storage if it ever carries a Suotar payload.
id uuid uuid_generate_v4() false A unique, stable identifier for the record.
reason text true The reason the actor typed. Nullable in the schema but required by the handlers for the destructive and overriding actions, because the required set will change and a migration per policy tweak is not worth it.
target_id uuid true The target row. NULL only for phase targets, which are keyed by name instead.
target_kind credit_registration_admin_action_target false What kind of thing the action was taken on.
target_phase varchar(64) true The pipeline phase acted on, set exactly when target_kind is phase.
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.

Viewpoints

Name Definition
Credit registration How a completed course module becomes a credit in the University of Helsinki study registry. Once the student has consented for the course and holds a student number proven to be theirs, one ledger row per completion is pushed to Sisu through Suotar and polled until the registry confirms the attainment.

Constraints

Name Type Definition
credit_registration_admin_actions_action_not_null n NOT NULL action
credit_registration_admin_actions_actor_course_id_fkey FOREIGN KEY FOREIGN KEY (actor_course_id) REFERENCES courses(id)
credit_registration_admin_actions_actor_role_not_null n NOT NULL actor_role
credit_registration_admin_actions_actor_user_id_fkey FOREIGN KEY FOREIGN KEY (actor_user_id) REFERENCES users(id)
credit_registration_admin_actions_actor_user_id_not_null n NOT NULL actor_user_id
credit_registration_admin_actions_created_at_not_null n NOT NULL created_at
credit_registration_admin_actions_id_not_null n NOT NULL id
credit_registration_admin_actions_pkey PRIMARY KEY PRIMARY KEY (id)
credit_registration_admin_actions_target_id_kind CHECK CHECK (((target_id IS NULL) = (target_kind = ‘phase’::credit_registration_admin_action_target)))
credit_registration_admin_actions_target_kind_not_null n NOT NULL target_kind
credit_registration_admin_actions_target_phase_kind CHECK CHECK (((target_phase IS NOT NULL) = (target_kind = ‘phase’::credit_registration_admin_action_target)))
credit_registration_admin_actions_updated_at_not_null n NOT NULL updated_at

Indexes

Name Definition
credit_registration_admin_actions_pkey CREATE UNIQUE INDEX credit_registration_admin_actions_pkey ON public.credit_registration_admin_actions USING btree (id)
idx_credit_registration_admin_actions_actor CREATE INDEX idx_credit_registration_admin_actions_actor ON public.credit_registration_admin_actions USING btree (actor_user_id, created_at DESC) WHERE (deleted_at IS NULL)
idx_credit_registration_admin_actions_course CREATE INDEX idx_credit_registration_admin_actions_course ON public.credit_registration_admin_actions USING btree (actor_course_id, created_at DESC) WHERE ((actor_course_id IS NOT NULL) AND (deleted_at IS NULL))
idx_credit_registration_admin_actions_created CREATE INDEX idx_credit_registration_admin_actions_created ON public.credit_registration_admin_actions USING btree (created_at DESC) WHERE (deleted_at IS NULL)
idx_credit_registration_admin_actions_target CREATE INDEX idx_credit_registration_admin_actions_target ON public.credit_registration_admin_actions USING btree (target_kind, target_id, created_at DESC) WHERE (deleted_at IS NULL)

Triggers

Name Definition
set_timestamp CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.credit_registration_admin_actions FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp()

Relations

er

Generated by tbls