Append-only audit trail for the credit registration ledger. There is no retention sweep here, so anything stored survives the 90-day suotar_api_calls window; every Suotar payload written to details is scrubbed at write time, but only best-effort — email addresses, student-number-shaped digit runs, access tokens and the known person fields are removed, while a personal name quoted in a free-text error message is deliberately left in place because the study registry holds it anyway. Treat this table as holding personal data, not as a guaranteed personal-data-free store.
| Name | Type | Default | Nullable | Children | Parents | Comment |
|---|---|---|---|---|---|---|
| actor_user_id | uuid | true | public.users | The acting user, set for admin_action and student_action events. | ||
| created_at | timestamp with time zone | clock_timestamp() | false | Timestamp when the record was created, taken from the wall clock rather than the transaction start, so events appended in one transaction stay orderable. This is what the timeline sorts on. | ||
| credit_registration_id | uuid | false | public.credit_registrations | The ledger row this event belongs to. Also the reference that replaces the identifiers removed from details, since the ledger row holds the real snapshot values. | ||
| deleted_at | timestamp with time zone | true | Timestamp when the record was deleted. Exists for convention and for personal data erasure; events are not soft-deleted in normal operation. | |||
| details | jsonb | true | Scrubbed per-item Suotar exchange, shaped {“request”: <the item we sent>, “response”: <the result or error we got>}. Both sides, because the admin drill-down renders them side by side and inferring the request afterwards is guesswork the moment anything is retried. Either key may be absent for non-Suotar events. Passed through scrub_suotar_body at every write site, never at read time. | |||
| error_code | credit_registration_error_code | true | The error code that caused this event, when there was one. | |||
| from_state | credit_registration_state | true | State before the change, for state_changed events. | |||
| id | uuid | uuid_generate_v4() | false | A unique, stable identifier for the record. | ||
| kind | credit_registration_event_kind | false | What kind of event this is. | |||
| message | text | true | Human-readable description, scrubbed of personal data before storage. | |||
| suotar_api_call_id | uuid | true | public.suotar_api_calls | The batch call this event came out of, if any. | ||
| to_state | credit_registration_state | true | State after the change, for state_changed events. | |||
| 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 | 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. |
| Name | Type | Definition |
|---|---|---|
| credit_registration_events_actor_user_id_fkey | FOREIGN KEY | FOREIGN KEY (actor_user_id) REFERENCES users(id) |
| credit_registration_events_created_at_not_null | n | NOT NULL created_at |
| credit_registration_events_credit_registration_id_fkey | FOREIGN KEY | FOREIGN KEY (credit_registration_id) REFERENCES credit_registrations(id) ON DELETE RESTRICT |
| credit_registration_events_credit_registration_id_not_null | n | NOT NULL credit_registration_id |
| credit_registration_events_id_not_null | n | NOT NULL id |
| credit_registration_events_kind_not_null | n | NOT NULL kind |
| credit_registration_events_pkey | PRIMARY KEY | PRIMARY KEY (id) |
| credit_registration_events_suotar_api_call_id_fkey | FOREIGN KEY | FOREIGN KEY (suotar_api_call_id) REFERENCES suotar_api_calls(id) ON DELETE SET NULL |
| credit_registration_events_updated_at_not_null | n | NOT NULL updated_at |
| Name | Definition |
|---|---|
| credit_registration_events_pkey | CREATE UNIQUE INDEX credit_registration_events_pkey ON public.credit_registration_events USING btree (id) |
| idx_credit_registration_events_api_call | CREATE INDEX idx_credit_registration_events_api_call ON public.credit_registration_events USING btree (suotar_api_call_id) WHERE (suotar_api_call_id IS NOT NULL) |
| idx_credit_registration_events_error_code | CREATE INDEX idx_credit_registration_events_error_code ON public.credit_registration_events USING btree (error_code, created_at DESC) WHERE (error_code IS NOT NULL) |
| idx_credit_registration_events_kind_created | CREATE INDEX idx_credit_registration_events_kind_created ON public.credit_registration_events USING btree (kind, created_at DESC) |
| idx_credit_registration_events_registration | CREATE INDEX idx_credit_registration_events_registration ON public.credit_registration_events USING btree (credit_registration_id, created_at DESC) |
| Name | Definition |
|---|---|
| set_timestamp | CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.credit_registration_events FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp() |
Generated by tbls