Index

public.moocfi_registration_reports

Description

Report-back of one mooc.fi ledger row to mooc.fi. Created when report-back first claims the row; a row of moocfi_reportable_registrations without one has not been tried yet.

Columns

Name Type Default Nullable Children Parents Comment
attempt_count integer 0 false Failed report-back attempts, which drive the backoff.
claimed_until timestamp with time zone true Lease of the reporter now posting this registration. Must outlast a lookup plus a post, or two reporters could both post.
created_at timestamp with time zone now() false Timestamp when the record was created.
credit_registration_id uuid false public.credit_registrations The ledger row reported. Unique among live rows.
deleted_at timestamp with time zone true Timestamp when the record was deleted. If null, the record is not deleted.
id uuid uuid_generate_v4() false A unique, stable identifier for the record.
last_error text true Why the last report-back attempt failed, for operators.
moocfi_completion_id uuid false mooc.fi’s id of the completion registered, which registration_date is unique within.
next_attempt_at timestamp with time zone now() false When report-back may next try this registration.
registration_date timestamp with time zone false The registration date reported, fixed when report-back first claims the row so a retry of the row cannot move it, in whole milliseconds as mooc.fi keeps it, and moved a millisecond on when another registration of the completion already has it. How report-back recognises the registration on mooc.fi after a post whose answer was lost.
reported_at timestamp with time zone true When mooc.fi was told about the registration, or it was found there already. Set once.
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.

Constraints

Name Type Definition
moocfi_registration_reports_attempt_count_check CHECK CHECK ((attempt_count >= 0))
moocfi_registration_reports_attempt_count_not_null n NOT NULL attempt_count
moocfi_registration_reports_created_at_not_null n NOT NULL created_at
moocfi_registration_reports_credit_registration_id_fkey FOREIGN KEY FOREIGN KEY (credit_registration_id) REFERENCES credit_registrations(id)
moocfi_registration_reports_credit_registration_id_not_null n NOT NULL credit_registration_id
moocfi_registration_reports_id_not_null n NOT NULL id
moocfi_registration_reports_moocfi_completion_id_not_null n NOT NULL moocfi_completion_id
moocfi_registration_reports_next_attempt_at_not_null n NOT NULL next_attempt_at
moocfi_registration_reports_pkey PRIMARY KEY PRIMARY KEY (id)
moocfi_registration_reports_registration_date_not_null n NOT NULL registration_date
moocfi_registration_reports_updated_at_not_null n NOT NULL updated_at

Indexes

Name Definition
moocfi_registration_reports_pkey CREATE UNIQUE INDEX moocfi_registration_reports_pkey ON public.moocfi_registration_reports USING btree (id)
uq_moocfi_registration_reports_date CREATE UNIQUE INDEX uq_moocfi_registration_reports_date ON public.moocfi_registration_reports USING btree (moocfi_completion_id, registration_date) WHERE (deleted_at IS NULL)
uq_moocfi_registration_reports_registration CREATE UNIQUE INDEX uq_moocfi_registration_reports_registration ON public.moocfi_registration_reports USING btree (credit_registration_id) WHERE (deleted_at IS NULL)

Triggers

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

Relations

er

Generated by tbls