Index

public.credit_registration_daily_snapshots

Description

Daily queue depth per ledger state. The ledger holds current state only, so a row that passed through a state in an hour leaves no depth trace and the dashboard trend charts have nothing to read. Aggregates only, deliberately: anything per-person belongs in the ledger. Roughly sixteen rows a day, so no retention policy is needed.

Columns

Name Type Default Nullable Children Parents Comment
count integer false End-of-day depth in this state.
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.
entered_count integer 0 false How many rows entered this state that day, from the event table. Makes the funnel flow columns cheap.
id uuid uuid_generate_v4() false A unique, stable identifier for the record.
left_count integer 0 false How many rows left this state that day, from the event table.
snapshot_date date false The day this row describes.
state credit_registration_state false The ledger state this row counts.
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. Enrolment on the course is itself the student’s consent to register the credit; once a student number is 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_daily_snapshots_count_not_null n NOT NULL count
credit_registration_daily_snapshots_created_at_not_null n NOT NULL created_at
credit_registration_daily_snapshots_entered_count_not_null n NOT NULL entered_count
credit_registration_daily_snapshots_id_not_null n NOT NULL id
credit_registration_daily_snapshots_left_count_not_null n NOT NULL left_count
credit_registration_daily_snapshots_pkey PRIMARY KEY PRIMARY KEY (id)
credit_registration_daily_snapshots_snapshot_date_not_null n NOT NULL snapshot_date
credit_registration_daily_snapshots_state_not_null n NOT NULL state
credit_registration_daily_snapshots_updated_at_not_null n NOT NULL updated_at

Indexes

Name Definition
credit_registration_daily_snapshots_pkey CREATE UNIQUE INDEX credit_registration_daily_snapshots_pkey ON public.credit_registration_daily_snapshots USING btree (id)
uq_credit_registration_daily_snapshots CREATE UNIQUE INDEX uq_credit_registration_daily_snapshots ON public.credit_registration_daily_snapshots USING btree (snapshot_date, state, deleted_at) NULLS NOT DISTINCT

Triggers

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

Relations

er

Generated by tbls