Holds an aggregate of page view stats for a course and country for a given day. If someone visits any page on a course, they will be counted in this stat. Can be also used to count all visitors to a course if you sum visits from all countries.
Name | Type | Default | Nullable | Children | Parents | Comment |
---|---|---|---|---|---|---|
country | varchar(255) | true | The country the visitor is from. | |||
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. | |||
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 | ||
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 |
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_c_course_id_exam_id_visit_date__key | UNIQUE | UNIQUE NULLS NOT DISTINCT (course_id, exam_id, visit_date, country, deleted_at) |
page_visit_datum_summary_by_courses_countries_course_id_fkey | FOREIGN KEY | FOREIGN KEY (course_id) REFERENCES courses(id) |
page_visit_datum_summary_by_courses_countries_exam_id_fkey | FOREIGN KEY | FOREIGN KEY (exam_id) REFERENCES exams(id) |
page_visit_datum_summary_by_courses_countries_pkey | PRIMARY KEY | PRIMARY KEY (id) |
Name | Definition |
---|---|
page_visit_datum_summary_by_c_course_id_exam_id_visit_date__key | CREATE UNIQUE INDEX page_visit_datum_summary_by_c_course_id_exam_id_visit_date__key ON public.page_visit_datum_summary_by_courses_countries USING btree (course_id, exam_id, visit_date, country, deleted_at) NULLS NOT DISTINCT |
page_visit_datum_summary_by_courses_countries_pkey | CREATE UNIQUE INDEX page_visit_datum_summary_by_courses_countries_pkey ON public.page_visit_datum_summary_by_courses_countries USING btree (id) |
Name | Definition |
---|---|
set_timestamp | CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.page_visit_datum_summary_by_courses_countries FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp() |
Generated by tbls