Index

public.page_visit_datum_summary_by_courses_device_types

Description

Holds an aggregate of page view stats for a course and differnet types of devices for a given day. For example, this table can be used to figure out what browsers people are using on the courses usually.

Columns

Name Type Default Nullable Children Parents Comment
browser varchar(255) true What browser the visitor was using e.g. Firefox.
browser_version varchar(255) true What what was the version of the browser the visitor was using e.g. 252.0
course_id uuid true public.courses If the statistic is for a course, the course that the page 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.
device_type varchar(255) true What kind of device the user was using e.g. mobile or pc.
exam_id uuid true public.exams If the statistic is for an exam, the exam that the page belongs to.
id uuid uuid_generate_v4() false A unique, stable identifier for the record.
num_visitors integer 0 false The number of visitors that visited the page with the given referrer
operating_system varchar(255) true What was the visitor’s operating system e.g. Linux
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.
visit_date date false The date that the page was visited

Constraints

Name Type Definition
exam_xor_course_id CHECK CHECK ((num_nonnulls(course_id, exam_id) = 1))
num_visitors_positive CHECK CHECK ((num_visitors >= 0))
page_visit_datum_summary_by_courses_device_types_course_id_fkey FOREIGN KEY FOREIGN KEY (course_id) REFERENCES courses(id)
page_visit_datum_summary_by_courses_device_types_exam_id_fkey FOREIGN KEY FOREIGN KEY (exam_id) REFERENCES exams(id)
page_visit_datum_summary_by_courses_device_types_pkey PRIMARY KEY PRIMARY KEY (id)
pvdsbcdt_no_duplicate_data UNIQUE UNIQUE NULLS NOT DISTINCT (course_id, exam_id, visit_date, browser, browser_version, operating_system, device_type, deleted_at)

Indexes

Name Definition
page_visit_datum_summary_by_courses_device_types_pkey CREATE UNIQUE INDEX page_visit_datum_summary_by_courses_device_types_pkey ON public.page_visit_datum_summary_by_courses_device_types USING btree (id)
pvdsbcdt_no_duplicate_data CREATE UNIQUE INDEX pvdsbcdt_no_duplicate_data ON public.page_visit_datum_summary_by_courses_device_types USING btree (course_id, exam_id, visit_date, browser, browser_version, operating_system, device_type, deleted_at) NULLS NOT DISTINCT

Triggers

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

Relations

er

Generated by tbls