AAttendrix Docsv1.0
Database
ReferenceImplemented

Database Tables & Schemas

Authoritative catalog and schema specifications for all 56 Attendrix PostgreSQL tables.

Database Tables & Schemas

Attendrix is backed by a relational PostgreSQL 17 database hosted on Supabase in AWS ap-south-1 (Mumbai). The database enforces strict referential integrity, statement-level audit logging, and Row-Level Security (RLS) across all tenant boundaries.

DATABASE STORAGE INVARIANT
INV-SEC-01

No tenant may query or mutate records outside their auth.uid() scope, except via audited SECURITY DEFINER functions that explicitly enforce role validation.

Architectural Organization

The Attendrix database comprises 56 application domain tables organized into 6 core functional subsystems:

  1. Core Academic & Timetable (15 tables)
  2. Attendance, Identity & Gamification (11 tables)
  3. Google Calendar Synchronization Pipeline (6 tables)
  4. Campus Pedestrian Routing & Transit (13 tables)
  5. Push Notifications & Student Tasks (8 tables)
  6. Audit & Governance (3 tables)

Core Academic & Timetable

Defines institutional structure, semesters, departments, courses, batch curricula, and scheduled lecture occurrences.

classes

Primary Key: class_id

Foreign Key Constraints:

  • batch_id → batches.batch_id (classes_batch_id_fkey)
  • semester_id → semesters.semester_id (classes_semester_id_fkey)
  • venue → campus_buildings.id (fk_classes_venue)
Field / PropTypeDefaultDescription
class_idrequired
uuidgen_random_uuid()**Primary Key**.
class_refrequired
text—Column `class_ref` stored as `text`.
batch_idrequired
text—Foreign key referencing `batches.batch_id`.
semester_idrequired
uuid—Foreign key referencing `semesters.semester_id`.
scheduled_startrequired
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
scheduled_endrequired
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
venue
text—Foreign key referencing `campus_buildings.id`.
is_plus_slotrequired
booleanfalsePostgreSQL UDT: `bool`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
course_idrequired
text—Column `course_id` stored as `text`.
is_extra_classrequired
booleanfalsePostgreSQL UDT: `bool`.
scheduled_daterequired
text—Column `scheduled_date` stored as `text`.
is_cancelledrequired
booleanfalsePostgreSQL UDT: `bool`.
cancelled_at
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
cancellation_reason
text—Column `cancellation_reason` stored as `text`.

courses

Primary Key: course_code

Foreign Key Constraints:

  • department_id → departments.department_id (courses_department_id_fkey)
Field / PropTypeDefaultDescription
course_coderequired
text—**Primary Key**.
course_namerequired
text—Column `course_name` stored as `text`.
course_type_coderequired
USER-DEFINED—PostgreSQL UDT: `course_type_code`.
is_labrequired
booleanfalsePostgreSQL UDT: `bool`.
creditsrequired
smallint—PostgreSQL UDT: `int2`.
department_idrequired
text—Foreign key referencing `departments.department_id`.
is_activerequired
booleantruePostgreSQL UDT: `bool`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
syllabus_url
text—Column `syllabus_url` stored as `text`.

batch_courses

Primary Key: course_slot, batch_id, course_code

Foreign Key Constraints:

  • batch_id → batches.batch_id (batch_courses_batch_id_fkey)
  • course_code → courses.course_code (batch_courses_course_code_fkey)
  • venue → campus_buildings.id (fk_batch_courses_venue)
Field / PropTypeDefaultDescription
offering_idrequired
uuidgen_random_uuid()Column `offering_id` stored as `uuid`.
batch_idrequired
text—**Primary Key**. Foreign key referencing `batches.batch_id`.
course_coderequired
text—**Primary Key**. Foreign key referencing `courses.course_code`.
course_slotrequired
text—**Primary Key**.
course_id
text—Column `course_id` stored as `text`.
is_mandatoryrequired
booleantruePostgreSQL UDT: `bool`.
added_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
enrolled_student_countrequired
integer0PostgreSQL UDT: `int4`.
venue
text—Foreign key referencing `campus_buildings.id`.

batches

Primary Key: batch_id

Foreign Key Constraints:

  • department_id → departments.department_id (batches_department_id_fkey)
Field / PropTypeDefaultDescription
batch_idrequired
text—**Primary Key**.
department_idrequired
text—Foreign key referencing `departments.department_id`.
batch_numberrequired
smallint—PostgreSQL UDT: `int2`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
department_namerequired
text—Column `department_name` stored as `text`.
is_activerequired
booleantruePostgreSQL UDT: `bool`.

semesters

Primary Key: semester_id

Field / PropTypeDefaultDescription
semester_idrequired
uuidgen_random_uuid()**Primary Key**.
semester_namerequired
text—Column `semester_name` stored as `text`.
start_daterequired
date—Column `start_date` stored as `date`.
end_daterequired
date—Column `end_date` stored as `date`.
is_activerequired
booleanfalsePostgreSQL UDT: `bool`.
locked_at
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
semester_number
integer—PostgreSQL UDT: `int4`.
semester_slot_system
smallint—PostgreSQL UDT: `int2`.

departments

Primary Key: department_id

Field / PropTypeDefaultDescription
department_idrequired
text—**Primary Key**.
department_namerequired
text—Column `department_name` stored as `text`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

slot_occurrences

Primary Key: slot_system, slot_name, day_of_week, period_number

Field / PropTypeDefaultDescription
slot_namerequired
text—**Primary Key**.
slot_systemrequired
smallint—**Primary Key**. PostgreSQL UDT: `int2`.
day_of_weekrequired
smallint—**Primary Key**. PostgreSQL UDT: `int2`.
period_numberrequired
smallint—**Primary Key**. PostgreSQL UDT: `int2`.
start_timerequired
time without time zone—PostgreSQL UDT: `time`.
end_timerequired
time without time zone—PostgreSQL UDT: `time`.
is_plus_slotrequired
booleanfalsePostgreSQL UDT: `bool`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
id
uuidgen_random_uuid()Column `id` stored as `uuid`.

course_meetings

Primary Key: id

Foreign Key Constraints:

  • batch_id → batches.batch_id (course_meetings_batch_id_fkey)
  • slot_occurrence_id → slot_occurrences.id (course_meetings_slot_occurrence_id_fkey)
Field / PropTypeDefaultDescription
idrequired
uuidgen_random_uuid()**Primary Key**.
batch_idrequired
text—Foreign key referencing `batches.batch_id`.
course_idrequired
text—Column `course_id` stored as `text`.
slot_occurrence_idrequired
uuid—Foreign key referencing `slot_occurrences.id`.
is_primaryrequired
booleantruePostgreSQL UDT: `bool`.
venue_override
text—Column `venue_override` stored as `text`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

elective_courses

Primary Key: offering_id

Foreign Key Constraints:

  • course_code → courses.course_code (elective_courses_course_code_fkey)
  • department_id → departments.department_id (elective_courses_department_id_fkey)
  • venue → campus_buildings.id (fk_elective_courses_venue)
Field / PropTypeDefaultDescription
offering_idrequired
uuidgen_random_uuid()**Primary Key**.
course_id
text—Column `course_id` stored as `text`.
course_coderequired
text—Foreign key referencing `courses.course_code`.
department_idrequired
text—Foreign key referencing `departments.department_id`.
slot_namerequired
text—Column `slot_name` stored as `text`.
slot_systemrequired
smallint1PostgreSQL UDT: `int2`.
venue
text—Foreign key referencing `campus_buildings.id`.
is_activerequired
booleantruePostgreSQL UDT: `bool`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
enrolled_student_countrequired
integer0PostgreSQL UDT: `int4`.

elective_offering_semesters

Primary Key: semester_number, offering_id

Foreign Key Constraints:

  • offering_id → elective_courses.offering_id (elective_offering_semesters_offering_id_fkey)
Field / PropTypeDefaultDescription
offering_idrequired
uuid—**Primary Key**. Foreign key referencing `elective_courses.offering_id`.
semester_numberrequired
smallint—**Primary Key**. PostgreSQL UDT: `int2`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

department_semester_rules

Primary Key: rule_id

Foreign Key Constraints:

  • department_id → departments.department_id (department_semester_rules_department_id_fkey)
Field / PropTypeDefaultDescription
rule_idrequired
uuidgen_random_uuid()**Primary Key**.
department_idrequired
text—Foreign key referencing `departments.department_id`.
semester_numberrequired
smallint—PostgreSQL UDT: `int2`.
elective_categoryrequired
text—Column `elective_category` stored as `text`.
required_countrequired
smallint—PostgreSQL UDT: `int2`.

course_syllabi

Primary Key: syllabus_id

Foreign Key Constraints:

  • course_code → courses.course_code (course_syllabi_course_code_fkey)
Field / PropTypeDefaultDescription
syllabus_idrequired
uuidgen_random_uuid()**Primary Key**.
course_coderequired
text—Foreign key referencing `courses.course_code`.
syllabus_pathrequired
text—Column `syllabus_path` stored as `text`.
created_atrequired
timestamp with time zonetimezone('utc'::text, now())PostgreSQL UDT: `timestamptz`.
prerequisites
text—Column `prerequisites` stored as `text`.
lecture_hours
smallint—PostgreSQL UDT: `int2`.
tutorial_hours
smallint—PostgreSQL UDT: `int2`.
practical_hours
smallint—PostgreSQL UDT: `int2`.
outside_hours
smallint—PostgreSQL UDT: `int2`.
lecture_sessions
smallint—PostgreSQL UDT: `int2`.
course_outcomes
ARRAY—PostgreSQL UDT: `_text`.
modules
jsonb—Column `modules` stored as `jsonb`.
textbooks
ARRAY—PostgreSQL UDT: `_text`.
reference_list
ARRAY—PostgreSQL UDT: `_text`.
raw_markdown
text—Column `raw_markdown` stored as `text`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
course_namerequired
text—Column `course_name` stored as `text`.

academic_calendar_events

Primary Key: event_id

Foreign Key Constraints:

  • semester_id → semesters.semester_id (academic_calendar_events_semester_id_fkey)
Field / PropTypeDefaultDescription
event_idrequired
uuidgen_random_uuid()**Primary Key**.
semester_idrequired
uuid—Foreign key referencing `semesters.semester_id`.
event_namerequired
text—Column `event_name` stored as `text`.
start_daterequired
date—Column `start_date` stored as `date`.
end_daterequired
date—Column `end_date` stored as `date`.
event_typerequired
text—Column `event_type` stored as `text`.
description
text—Column `description` stored as `text`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
follows_day
smallint—PostgreSQL UDT: `int2`.
formatted_date
text—Column `formatted_date` stored as `text`.

academic_calendar_overrides

Primary Key: id

Foreign Key Constraints:

  • course_meeting_id → course_meetings.id (academic_calendar_overrides_course_meeting_id_fkey)
Field / PropTypeDefaultDescription
idrequired
uuidgen_random_uuid()**Primary Key**.
override_daterequired
date—Column `override_date` stored as `date`.
override_typerequired
text—Column `override_type` stored as `text`.
effective_day
smallint—PostgreSQL UDT: `int2`.
course_id
text—Column `course_id` stored as `text`.
course_meeting_id
uuid—Foreign key referencing `course_meetings.id`.
override_start
time without time zone—PostgreSQL UDT: `time`.
override_end
time without time zone—PostgreSQL UDT: `time`.
override_venue
text—Column `override_venue` stored as `text`.
description
text—Column `description` stored as `text`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

class_cancellation_reports

Primary Key: report_id

Foreign Key Constraints:

  • class_id → classes.class_id (class_cancellation_reports_class_id_fkey)
Field / PropTypeDefaultDescription
report_idrequired
uuidgen_random_uuid()**Primary Key**.
class_idrequired
uuid—Foreign key referencing `classes.class_id`.
user_idrequired
uuid—Column `user_id` stored as `uuid`.
reported_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

Attendance, Identity & Gamification

Powers the inverted attendance ledger, student profiles, Amplix points economy, and automated streak/achievement milestones.

absences

Primary Key: absence_id

Foreign Key Constraints:

  • class_id → classes.class_id (absences_class_id_fkey)
Field / PropTypeDefaultDescription
absence_idrequired
uuidgen_random_uuid()**Primary Key**.
user_idrequired
uuid—Column `user_id` stored as `uuid`.
class_idrequired
uuid—Foreign key referencing `classes.class_id`.
marked_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
marked_by
uuid—Column `marked_by` stored as `uuid`.
sourcerequired
text—Column `source` stored as `text`.
reason
text—Column `reason` stored as `text`.

user_course_attendance_state

Primary Key: user_id, course_id

Foreign Key Constraints:

  • user_id → users.id (user_course_attendance_state_user_id_fkey)
Field / PropTypeDefaultDescription
user_idrequired
uuid—**Primary Key**. Foreign key referencing `users.id`.
course_idrequired
text—**Primary Key**.
staterequired
text'NORMAL'::textColumn `state` stored as `text`.
last_percentagerequired
numeric—Column `last_percentage` stored as `numeric`.
updated_at
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

user_course_enrollments

Primary Key: id

Foreign Key Constraints:

  • user_id → users.id (user_course_enrollments_user_id_fkey)
Field / PropTypeDefaultDescription
idrequired
uuidgen_random_uuid()**Primary Key**.
user_idrequired
uuid—Foreign key referencing `users.id`.
course_idrequired
text—Column `course_id` stored as `text`.
enrolled_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

users

Primary Key: id

Foreign Key Constraints:

  • batch_id → batches.batch_id (users_batch_id_fkey)
  • department_id → departments.department_id (users_department_id_fkey)
  • id → null.null (users_id_fkey)
Field / PropTypeDefaultDescription
idrequired
uuid—**Primary Key**. Foreign key referencing `null.null`.
emailrequired
text—Column `email` stored as `text`.
full_namerequired
text—Column `full_name` stored as `text`.
rolerequired
USER-DEFINED'student'::user_rolePostgreSQL UDT: `user_role`.
avatar_url
text—Column `avatar_url` stored as `text`.
email_verifiedrequired
booleanfalsePostgreSQL UDT: `bool`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
username
text—Column `username` stored as `text`.
bio
text—Column `bio` stored as `text`.
department_id
text—Foreign key referencing `departments.department_id`.
batch_id
text—Foreign key referencing `batches.batch_id`.
current_semester
smallint—PostgreSQL UDT: `int2`.
onboarding_completedrequired
booleanfalsePostgreSQL UDT: `bool`.
roll_number
text—Column `roll_number` stored as `text`.
amplix_balancerequired
integer0PostgreSQL UDT: `int4`.
current_streakrequired
integer0PostgreSQL UDT: `int4`.
highest_streakrequired
integer0PostgreSQL UDT: `int4`.
enrolled_coursesrequired
jsonb'[]'::jsonbColumn `enrolled_courses` stored as `jsonb`.
profile_updated_at
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
odometer
integer0PostgreSQL UDT: `int4`.

user_preferences

Primary Key: user_id

Foreign Key Constraints:

  • user_id → users.id (user_preferences_user_id_fkey)
Field / PropTypeDefaultDescription
user_idrequired
uuid—**Primary Key**. Foreign key referencing `users.id`.
themerequired
text'system'::textColumn `theme` stored as `text`.
time_formatrequired
text'12h'::textColumn `time_format` stored as `text`.
timezonerequired
text'Asia/Kolkata'::textColumn `timezone` stored as `text`.
languagerequired
text'en'::textColumn `language` stored as `text`.
action_tonerequired
USER-DEFINED'direct'::action_tonePostgreSQL UDT: `action_tone`.
notifications_enabledrequired
booleantruePostgreSQL UDT: `bool`.
notif_class_reminderrequired
booleantruePostgreSQL UDT: `bool`.
notif_reminder_minutesrequired
smallint10PostgreSQL UDT: `int2`.
notif_class_cancelledrequired
booleantruePostgreSQL UDT: `bool`.
notif_class_rescheduledrequired
booleantruePostgreSQL UDT: `bool`.
notif_task_publishedrequired
booleantruePostgreSQL UDT: `bool`.
notif_task_due_soonrequired
booleantruePostgreSQL UDT: `bool`.
notif_exam_reminderrequired
booleantruePostgreSQL UDT: `bool`.
notif_daily_briefrequired
booleantruePostgreSQL UDT: `bool`.
notif_attendance_alertrequired
booleantruePostgreSQL UDT: `bool`.
notif_weekly_summaryrequired
booleantruePostgreSQL UDT: `bool`.
quiet_hours_enabledrequired
booleanfalsePostgreSQL UDT: `bool`.
quiet_hours_startrequired
time without time zone'22:00:00'::time without time zonePostgreSQL UDT: `time`.
quiet_hours_endrequired
time without time zone'07:00:00'::time without time zonePostgreSQL UDT: `time`.
attendance_thresholdrequired
smallint80PostgreSQL UDT: `int2`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
enable_apodrequired
booleantruePostgreSQL UDT: `bool`.
user_messrequired
text''::textColumn `user_mess` stored as `text`.
at_a_glance_viewrequired
booleantruePostgreSQL UDT: `bool`.
use_scheduled_classes_for_greeting_messagerequired
booleantruePostgreSQL UDT: `bool`.
use_action_tone_for_greeting_messagerequired
booleantruePostgreSQL UDT: `bool`.
daily_brief_timerequired
time without time zone'07:00:00'::time without time zonePostgreSQL UDT: `time`.
notif_mess_reminderrequired
booleantruePostgreSQL UDT: `bool`.
notif_breakfast_reminderrequired
booleantruePostgreSQL UDT: `bool`.
notif_lunch_reminderrequired
booleantruePostgreSQL UDT: `bool`.
notif_evening_tea_reminderrequired
booleantruePostgreSQL UDT: `bool`.
notif_dinner_reminderrequired
booleantruePostgreSQL UDT: `bool`.
notif_mess_reminder_minutesrequired
smallint20PostgreSQL UDT: `int2`.

amplix_ledger

Primary Key: ledger_id

Foreign Key Constraints:

  • achievement_progress_id → achievement_progress.achievement_progress_id (amplix_ledger_achievement_progress_id_fkey)
  • challenge_progress_id → challenge_progress.progress_id (amplix_ledger_challenge_progress_id_fkey)
  • class_id → classes.class_id (amplix_ledger_class_id_fkey)
Field / PropTypeDefaultDescription
ledger_idrequired
uuidgen_random_uuid()**Primary Key**.
user_idrequired
uuid—Column `user_id` stored as `uuid`.
event_typerequired
text—Column `event_type` stored as `text`.
pointsrequired
integer—PostgreSQL UDT: `int4`.
balance_afterrequired
integer—PostgreSQL UDT: `int4`.
class_id
uuid—Foreign key referencing `classes.class_id`.
event_daterequired
date—Column `event_date` stored as `date`.
notes
text—Column `notes` stored as `text`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
achievement_progress_id
uuid—Foreign key referencing `achievement_progress.achievement_progress_id`.
challenge_progress_id
uuid—Foreign key referencing `challenge_progress.progress_id`.

achievement_templates

Primary Key: achievement_id

Field / PropTypeDefaultDescription
achievement_idrequired
text—**Primary Key**.
achievement_namerequired
text—Column `achievement_name` stored as `text`.
achievement_descriptionrequired
text—Column `achievement_description` stored as `text`.
badge_icon
text—Column `badge_icon` stored as `text`.
achievement_conditionrequired
USER-DEFINED—PostgreSQL UDT: `achievement_condition`.
threshold_valuerequired
integer—PostgreSQL UDT: `int4`.
amplix_rewardrequired
integer0PostgreSQL UDT: `int4`.
is_activerequired
booleantruePostgreSQL UDT: `bool`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

achievement_progress

Primary Key: achievement_progress_id

Foreign Key Constraints:

  • achievement_id → achievement_templates.achievement_id (achievement_progress_achievement_id_fkey)
Field / PropTypeDefaultDescription
achievement_progress_idrequired
uuidgen_random_uuid()**Primary Key**.
student_idrequired
uuid—Column `student_id` stored as `uuid`.
achievement_idrequired
text—Foreign key referencing `achievement_templates.achievement_id`.
progressrequired
integer0PostgreSQL UDT: `int4`.
statusrequired
text'in_progress'::textColumn `status` stored as `text`.
claimed_at
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

challenge_templates

Primary Key: challenge_id

Field / PropTypeDefaultDescription
challenge_idrequired
text—**Primary Key**.
challenge_namerequired
text—Column `challenge_name` stored as `text`.
challenge_descriptionrequired
text—Column `challenge_description` stored as `text`.
challenge_typerequired
USER-DEFINED—PostgreSQL UDT: `challenge_type`.
challenge_conditionrequired
USER-DEFINED—PostgreSQL UDT: `challenge_condition`.
condition_paramsrequired
jsonb'{}'::jsonbColumn `condition_params` stored as `jsonb`.
target_valuerequired
integer—PostgreSQL UDT: `int4`.
amplix_rewardrequired
integer0PostgreSQL UDT: `int4`.
weekly_weightrequired
integer1PostgreSQL UDT: `int4`.
monthly_weightrequired
integer1PostgreSQL UDT: `int4`.
template_versionrequired
integer1PostgreSQL UDT: `int4`.
is_activerequired
booleantruePostgreSQL UDT: `bool`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

challenge_progress

Primary Key: progress_id

Foreign Key Constraints:

  • challenge_id → challenge_templates.challenge_id (challenge_progress_challenge_id_fkey)
  • semester_id → semesters.semester_id (challenge_progress_semester_id_fkey)
Field / PropTypeDefaultDescription
progress_idrequired
uuidgen_random_uuid()**Primary Key**.
user_idrequired
uuid—Column `user_id` stored as `uuid`.
challenge_idrequired
text—Foreign key referencing `challenge_templates.challenge_id`.
semester_idrequired
uuid—Foreign key referencing `semesters.semester_id`.
period_keyrequired
text—Column `period_key` stored as `text`.
template_versionrequired
integer—PostgreSQL UDT: `int4`.
progressrequired
integer0PostgreSQL UDT: `int4`.
target_valuerequired
integer—PostgreSQL UDT: `int4`.
amplix_rewardrequired
integer—PostgreSQL UDT: `int4`.
statusrequired
text'pending'::textColumn `status` stored as `text`.
completed_at
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
claimed_at
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
expires_atrequired
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

challenge_progress_classes

Primary Key: progress_id, class_id

Foreign Key Constraints:

  • class_id → classes.class_id (challenge_progress_classes_class_id_fkey)
  • progress_id → challenge_progress.progress_id (challenge_progress_classes_progress_id_fkey)
Field / PropTypeDefaultDescription
progress_idrequired
uuid—**Primary Key**. Foreign key referencing `challenge_progress.progress_id`.
class_idrequired
uuid—**Primary Key**. Foreign key referencing `classes.class_id`.
contributed_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

Google Calendar Synchronization Pipeline

Implements statement-coalesced calendar synchronization, distributed lease management, and OAuth token encryption.

user_google_integrations

Primary Key: user_id

Field / PropTypeDefaultDescription
user_idrequired
uuid—**Primary Key**.
google_emailrequired
text—Column `google_email` stored as `text`.
calendar_id
text—Column `calendar_id` stored as `text`.
calendar_color_id
text'7'::textColumn `calendar_color_id` stored as `text`.
is_sync_enabledrequired
booleantruePostgreSQL UDT: `bool`.
vault_secret_idrequired
uuid—Column `vault_secret_id` stored as `uuid`.
sync_statusrequired
text'pending_initial_sync'::textColumn `sync_status` stored as `text`.
last_synced_at
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
last_error
text—Column `last_error` stored as `text`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
sync_generationrequired
integer1PostgreSQL UDT: `int4`.

user_calendar_events

Primary Key: class_id, user_id

Foreign Key Constraints:

  • class_id → classes.class_id (user_calendar_events_class_id_fkey)
Field / PropTypeDefaultDescription
user_idrequired
uuid—**Primary Key**.
class_idrequired
uuid—**Primary Key**. Foreign key referencing `classes.class_id`.
google_event_idrequired
text—Column `google_event_id` stored as `text`.
sync_staterequired
text'synced'::textColumn `sync_state` stored as `text`.
synced_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
source_hash
text—Column `source_hash` stored as `text`.

gcal_sync_queue

Primary Key: job_id

Field / PropTypeDefaultDescription
job_idrequired
bigint—**Primary Key**. PostgreSQL UDT: `int8`.
job_typerequired
text—Column `job_type` stored as `text`.
payloadrequired
jsonb—Column `payload` stored as `jsonb`.
statusrequired
text'pending'::textColumn `status` stored as `text`.
attemptsrequired
integer0PostgreSQL UDT: `int4`.
max_attemptsrequired
integer5PostgreSQL UDT: `int4`.
next_run_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
processing_started_at
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
worker_id
text—Column `worker_id` stored as `text`.
last_error
text—Column `last_error` stored as `text`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
completed_at
timestamp with time zone—PostgreSQL UDT: `timestamptz`.

gcal_sync_pending

Primary Key: batch_id

Field / PropTypeDefaultDescription
batch_idrequired
text—**Primary Key**.
sync_generationrequired
integer1PostgreSQL UDT: `int4`.
requested_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
locked_until
timestamp with time zone—PostgreSQL UDT: `timestamptz`.

user_calendar_sync_leases

Primary Key: user_id

Foreign Key Constraints:

  • user_id → users.id (user_calendar_sync_leases_user_id_fkey)
Field / PropTypeDefaultDescription
user_idrequired
uuid—**Primary Key**. Foreign key referencing `users.id`.
worker_idrequired
text—Column `worker_id` stored as `text`.
lease_expires_atrequired
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
updated_at
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

oauth_states

Primary Key: state

Field / PropTypeDefaultDescription
staterequired
text—**Primary Key**.
user_idrequired
uuid—Column `user_id` stored as `uuid`.
pkce_verifier
text''::textColumn `pkce_verifier` stored as `text`.
expires_atrequired
timestamp with time zone(now() + '00:10:00'::interval)PostgreSQL UDT: `timestamptz`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
redirect_uri
text—Column `redirect_uri` stored as `text`.

Campus Pedestrian Routing & Transit

Contains the offline graph network, precomputed all-pairs shortest paths (152,904 pairs), real-time bus tracking, and dining menus.

campus_buildings

Primary Key: id

Field / PropTypeDefaultDescription
idrequired
text—**Primary Key**.
namerequired
text—Column `name` stored as `text`.
category
text—Column `category` stored as `text`.
latrequired
double precision—PostgreSQL UDT: `float8`.
lngrequired
double precision—PostgreSQL UDT: `float8`.
nearest_node_idrequired
bigint—PostgreSQL UDT: `int8`.
snap_dist_m
real—PostgreSQL UDT: `float4`.
description
text—Column `description` stored as `text`.
created_at
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
lon
double precision—PostgreSQL UDT: `float8`.
amenity
text—Column `amenity` stored as `text`.
building_type
text—Column `building_type` stored as `text`.

graph_nodes

Primary Key: id

Field / PropTypeDefaultDescription
idrequired
bigint—**Primary Key**. PostgreSQL UDT: `int8`.
latrequired
double precision—PostgreSQL UDT: `float8`.
lonrequired
double precision—PostgreSQL UDT: `float8`.
lng
double precision—PostgreSQL UDT: `float8`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

graph_edges

Primary Key: id

Foreign Key Constraints:

  • source_node_id → graph_nodes.id (graph_edges_source_node_id_fkey)
  • target_node_id → graph_nodes.id (graph_edges_target_node_id_fkey)
Field / PropTypeDefaultDescription
idrequired
bigint—**Primary Key**. PostgreSQL UDT: `int8`.
source_node_idrequired
bigint—Foreign key referencing `graph_nodes.id`. PostgreSQL UDT: `int8`.
target_node_idrequired
bigint—Foreign key referencing `graph_nodes.id`. PostgreSQL UDT: `int8`.
distance_mrequired
double precision—PostgreSQL UDT: `float8`.
walk_secondsrequired
integer—PostgreSQL UDT: `int4`.
is_bidirectionalrequired
booleantruePostgreSQL UDT: `bool`.
geometryrequired
jsonb—Column `geometry` stored as `jsonb`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

routing_dataset_versions

Primary Key: version

Field / PropTypeDefaultDescription
versionrequired
integer—**Primary Key**. PostgreSQL UDT: `int4`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
published_at
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
node_countrequired
integer—PostgreSQL UDT: `int4`.
route_countrequired
integer—PostgreSQL UDT: `int4`.
tier1_observed_countrequired
integer0PostgreSQL UDT: `int4`.
tier2_edge_weight_countrequired
integer0PostgreSQL UDT: `int4`.
tier3_graph_dist_countrequired
integer0PostgreSQL UDT: `int4`.
tier4_fallback_countrequired
integer0PostgreSQL UDT: `int4`.
metadatarequired
jsonb'{}'::jsonbColumn `metadata` stored as `jsonb`.
is_activerequired
booleanfalsePostgreSQL UDT: `bool`.

routing_dataset_routes

Primary Key: origin_node_id, version, destination_node_id

Foreign Key Constraints:

  • destination_node_id → graph_nodes.id (routing_dataset_routes_destination_node_id_fkey)
  • origin_node_id → graph_nodes.id (routing_dataset_routes_origin_node_id_fkey)
  • version → routing_dataset_versions.version (routing_dataset_routes_version_fkey)
Field / PropTypeDefaultDescription
versionrequired
integer—**Primary Key**. Foreign key referencing `routing_dataset_versions.version`. PostgreSQL UDT: `int4`.
origin_node_idrequired
bigint—**Primary Key**. Foreign key referencing `graph_nodes.id`. PostgreSQL UDT: `int8`.
destination_node_idrequired
bigint—**Primary Key**. Foreign key referencing `graph_nodes.id`. PostgreSQL UDT: `int8`.
walk_secondsrequired
integer—PostgreSQL UDT: `int4`.
distance_m
double precision—PostgreSQL UDT: `float8`.
sourcerequired
text—Column `source` stored as `text`.

observed_walking_trips

Primary Key: id

Foreign Key Constraints:

  • destination_node_id → graph_nodes.id (observed_walking_trips_destination_node_id_fkey)
  • origin_node_id → graph_nodes.id (observed_walking_trips_origin_node_id_fkey)
  • user_id → users.id (observed_walking_trips_user_id_fkey)
Field / PropTypeDefaultDescription
idrequired
uuidgen_random_uuid()**Primary Key**.
user_idrequired
uuid—Foreign key referencing `users.id`.
origin_node_idrequired
bigint—Foreign key referencing `graph_nodes.id`. PostgreSQL UDT: `int8`.
destination_node_idrequired
bigint—Foreign key referencing `graph_nodes.id`. PostgreSQL UDT: `int8`.
started_atrequired
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
arrived_atrequired
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
duration_secondsrequired
integer—PostgreSQL UDT: `int4`.
distance_meters
double precision—PostgreSQL UDT: `float8`.
gps_fix_countrequired
integer0PostgreSQL UDT: `int4`.
avg_horizontal_accuracy_m
real—PostgreSQL UDT: `float4`.
is_outlierrequired
booleanfalsePostgreSQL UDT: `bool`.
outlier_reason
text—Column `outlier_reason` stored as `text`.
device_metadata
jsonb'{}'::jsonbColumn `device_metadata` stored as `jsonb`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

route_cache

Primary Key: id

Foreign Key Constraints:

  • dest_building_id → campus_buildings.id (route_cache_dest_building_id_fkey)
  • origin_building_id → campus_buildings.id (route_cache_origin_building_id_fkey)
Field / PropTypeDefaultDescription
idrequired
uuidgen_random_uuid()**Primary Key**.
origin_building_id
text—Foreign key referencing `campus_buildings.id`.
dest_building_id
text—Foreign key referencing `campus_buildings.id`.
route_resultrequired
jsonb—Column `route_result` stored as `jsonb`.
distance_mrequired
double precision—PostgreSQL UDT: `float8`.
walk_secondsrequired
integer—PostgreSQL UDT: `int4`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

route_statistics

Primary Key: origin_node_id, destination_node_id

Foreign Key Constraints:

  • destination_node_id → graph_nodes.id (route_statistics_destination_node_id_fkey)
  • origin_node_id → graph_nodes.id (route_statistics_origin_node_id_fkey)
Field / PropTypeDefaultDescription
origin_node_idrequired
bigint—**Primary Key**. Foreign key referencing `graph_nodes.id`. PostgreSQL UDT: `int8`.
destination_node_idrequired
bigint—**Primary Key**. Foreign key referencing `graph_nodes.id`. PostgreSQL UDT: `int8`.
sample_countrequired
integer0PostgreSQL UDT: `int4`.
p50_duration_secondsrequired
integer—PostgreSQL UDT: `int4`.
p75_duration_secondsrequired
integer—PostgreSQL UDT: `int4`.
p90_duration_seconds
integer—PostgreSQL UDT: `int4`.
min_duration_seconds
integer—PostgreSQL UDT: `int4`.
max_duration_seconds
integer—PostgreSQL UDT: `int4`.
mean_duration_seconds
numeric—Column `mean_duration_seconds` stored as `numeric`.
representative_distance_m
double precision—PostgreSQL UDT: `float8`.
last_observed_at
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

buses

Primary Key: bus_id

Field / PropTypeDefaultDescription
bus_idrequired
uuidgen_random_uuid()**Primary Key**.
route_namerequired
text—Column `route_name` stored as `text`.
stops_summaryrequired
text—Column `stops_summary` stored as `text`.
is_active
booleantruePostgreSQL UDT: `bool`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

bus_stops

Primary Key: id

Foreign Key Constraints:

  • nearest_node_id → graph_nodes.id (bus_stops_nearest_node_id_fkey)
Field / PropTypeDefaultDescription
idrequired
uuidgen_random_uuid()**Primary Key**.
stop_idrequired
text—Column `stop_id` stored as `text`.
namerequired
text—Column `name` stored as `text`.
latrequired
double precision—PostgreSQL UDT: `float8`.
lngrequired
double precision—PostgreSQL UDT: `float8`.
nearest_node_id
bigint—Foreign key referencing `graph_nodes.id`. PostgreSQL UDT: `int8`.
is_activerequired
booleantruePostgreSQL UDT: `bool`.
description
text—Column `description` stored as `text`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

bus_timings

Primary Key: timing_id

Foreign Key Constraints:

  • bus_id → buses.bus_id (bus_timings_bus_id_fkey)
Field / PropTypeDefaultDescription
timing_idrequired
uuidgen_random_uuid()**Primary Key**.
bus_id
uuid—Foreign key referencing `buses.bus_id`.
departure_timerequired
time without time zone—PostgreSQL UDT: `time`.
is_special
booleanfalsePostgreSQL UDT: `bool`.
sort_orderrequired
integer—PostgreSQL UDT: `int4`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

messes

Primary Key: mess_id

Field / PropTypeDefaultDescription
mess_idrequired
uuidgen_random_uuid()**Primary Key**.
namerequired
text—Column `name` stored as `text`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

mess_menu

Primary Key: menu_id

Foreign Key Constraints:

  • mess_id → messes.mess_id (mess_menu_mess_id_fkey)
Field / PropTypeDefaultDescription
menu_idrequired
uuidgen_random_uuid()**Primary Key**.
mess_id
uuid—Foreign key referencing `messes.mess_id`.
weekdayrequired
smallint—PostgreSQL UDT: `int2`.
mealrequired
text—Column `meal` stored as `text`.
menurequired
text—Column `menu` stored as `text`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

Push Notifications & Student Tasks

OneSignal push notification queues, dispatch logs, academic assignment trackers, and NASA APOD media caching.

notification_devices

Primary Key: device_id

Field / PropTypeDefaultDescription
device_idrequired
uuidgen_random_uuid()**Primary Key**.
user_idrequired
uuid—Column `user_id` stored as `uuid`.
onesignal_subscription_idrequired
text—Column `onesignal_subscription_id` stored as `text`.
platformrequired
text—Column `platform` stored as `text`.
app_version
text—Column `app_version` stored as `text`.
device_model
text—Column `device_model` stored as `text`.
is_activerequired
booleantruePostgreSQL UDT: `bool`.
last_seen_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
registered_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
deactivated_at
timestamp with time zone—PostgreSQL UDT: `timestamptz`.

notification_queue

Primary Key: job_id

Foreign Key Constraints:

  • recipient_batch_id → batches.batch_id (notification_queue_recipient_batch_id_fkey)
Field / PropTypeDefaultDescription
job_idrequired
bigint—**Primary Key**. PostgreSQL UDT: `int8`.
notification_typerequired
text—Column `notification_type` stored as `text`.
recipient_user_id
uuid—Column `recipient_user_id` stored as `uuid`.
recipient_batch_id
text—Foreign key referencing `batches.batch_id`.
course_id
text—Column `course_id` stored as `text`.
payloadrequired
jsonb'{}'::jsonbColumn `payload` stored as `jsonb`.
dedup_key
text—Column `dedup_key` stored as `text`.
statusrequired
text'pending'::textColumn `status` stored as `text`.
attemptsrequired
integer0PostgreSQL UDT: `int4`.
max_attemptsrequired
integer3PostgreSQL UDT: `int4`.
scheduled_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
processing_started_at
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
worker_id
text—Column `worker_id` stored as `text`.
sent_at
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
last_error
text—Column `last_error` stored as `text`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
dedup_key_checked
booleanfalsePostgreSQL UDT: `bool`.
next_retry_at
timestamp with time zone—PostgreSQL UDT: `timestamptz`.

notification_log

Primary Key: log_id

Foreign Key Constraints:

  • related_class_id → classes.class_id (notification_log_related_class_id_fkey)
  • related_task_id → tasks.task_id (notification_log_related_task_id_fkey)
Field / PropTypeDefaultDescription
log_idrequired
uuidgen_random_uuid()**Primary Key**.
user_idrequired
uuid—Column `user_id` stored as `uuid`.
notification_typerequired
text—Column `notification_type` stored as `text`.
titlerequired
text—Column `title` stored as `text`.
bodyrequired
text—Column `body` stored as `text`.
datarequired
jsonb'{}'::jsonbColumn `data` stored as `jsonb`.
onesignal_id
text—Column `onesignal_id` stored as `text`.
is_readrequired
booleanfalsePostgreSQL UDT: `bool`.
read_at
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
sent_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
related_class_id
uuid—Foreign key referencing `classes.class_id`.
related_task_id
uuid—Foreign key referencing `tasks.task_id`.
dedup_key
text—Column `dedup_key` stored as `text`.
delivery_status
text'sent'::textColumn `delivery_status` stored as `text`.
onesignal_recipients
integer0PostgreSQL UDT: `int4`.

notification_daily_stats

Primary Key: None

Field / PropTypeDefaultDescription
stat_date
date—Column `stat_date` stored as `date`.
notification_type
text—Column `notification_type` stored as `text`.
delivery_status
text—Column `delivery_status` stored as `text`.
total_jobs
bigint—PostgreSQL UDT: `int8`.
total_recipients
bigint—PostgreSQL UDT: `int8`.

tasks

Primary Key: task_id

Foreign Key Constraints:

  • batch_id → batches.batch_id (tasks_batch_id_fkey)
  • course_code → courses.course_code (tasks_course_code_fkey)
  • semester_id → semesters.semester_id (tasks_semester_id_fkey)
Field / PropTypeDefaultDescription
task_idrequired
uuidgen_random_uuid()**Primary Key**.
semester_idrequired
uuid—Foreign key referencing `semesters.semester_id`.
batch_id
text—Foreign key referencing `batches.batch_id`.
task_typerequired
text—Column `task_type` stored as `text`.
titlerequired
text—Column `title` stored as `text`.
description
text—Column `description` stored as `text`.
due_date
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
exam_start
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
exam_end
timestamp with time zone—PostgreSQL UDT: `timestamptz`.
venue
text—Column `venue` stored as `text`.
max_score
numeric—Column `max_score` stored as `numeric`.
attachmentsrequired
jsonb'[]'::jsonbColumn `attachments` stored as `jsonb`.
is_visiblerequired
booleantruePostgreSQL UDT: `bool`.
created_byrequired
uuid—Column `created_by` stored as `uuid`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
course_coderequired
text—Foreign key referencing `courses.course_code`.

student_task_records

Primary Key: record_id

Foreign Key Constraints:

  • task_id → tasks.task_id (student_task_records_task_id_fkey)
Field / PropTypeDefaultDescription
record_idrequired
uuidgen_random_uuid()**Primary Key**.
user_idrequired
uuid—Column `user_id` stored as `uuid`.
task_idrequired
uuid—Foreign key referencing `tasks.task_id`.
statusrequired
text'pending'::textColumn `status` stored as `text`.
obtained_marks
numeric—Column `obtained_marks` stored as `numeric`.
personal_note
text—Column `personal_note` stored as `text`.
marked_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

app_version_control

Primary Key: version_id

Field / PropTypeDefaultDescription
version_idrequired
uuidgen_random_uuid()**Primary Key**.
current_versionrequired
text—Column `current_version` stored as `text`.
build_numberrequired
bigint—PostgreSQL UDT: `int8`.
version_download_link
text—Column `version_download_link` stored as `text`.
is_web_availablerequired
booleanfalsePostgreSQL UDT: `bool`.
force_updaterequired
booleanfalsePostgreSQL UDT: `bool`.
is_currentrequired
booleanfalsePostgreSQL UDT: `bool`.
release_notes
text—Column `release_notes` stored as `text`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
updated_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

apod

Primary Key: apod_date

Field / PropTypeDefaultDescription
apod_daterequired
date—**Primary Key**.
titlerequired
text—Column `title` stored as `text`.
descriptionrequired
text—Column `description` stored as `text`.
image_url
text—Column `image_url` stored as `text`.
hd_image_url
text—Column `hd_image_url` stored as `text`.
media_typerequired
text'image'::textColumn `media_type` stored as `text`.
fetched_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
blur_hash
text—Column `blur_hash` stored as `text`.

Audit & Governance

Immutable system logs tracking administrative actions, timetable regenerations, and Row-Level Security policy execution.

admin_audit_log

Primary Key: log_id

Foreign Key Constraints:

  • semester_id → semesters.semester_id (admin_audit_log_semester_id_fkey)
Field / PropTypeDefaultDescription
log_idrequired
uuidgen_random_uuid()**Primary Key**.
admin_idrequired
uuid—Column `admin_id` stored as `uuid`.
action_typerequired
text—Column `action_type` stored as `text`.
target_tablerequired
text—Column `target_table` stored as `text`.
target_idrequired
text—Column `target_id` stored as `text`.
before_state
jsonb—Column `before_state` stored as `jsonb`.
after_state
jsonb—Column `after_state` stored as `jsonb`.
semester_id
uuid—Foreign key referencing `semesters.semester_id`.
performed_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

audit_log

Primary Key: audit_id

Field / PropTypeDefaultDescription
audit_idrequired
bigint—**Primary Key**. PostgreSQL UDT: `int8`.
table_namerequired
text—Column `table_name` stored as `text`.
operationrequired
text—Column `operation` stored as `text`.
actor_id
uuid—Column `actor_id` stored as `uuid`.
row_pk
text—Column `row_pk` stored as `text`.
old_data
jsonb—Column `old_data` stored as `jsonb`.
new_data
jsonb—Column `new_data` stored as `jsonb`.
created_atrequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.

scheduling_audit_log

Primary Key: log_id

Foreign Key Constraints:

  • batch_id → batches.batch_id (scheduling_audit_log_batch_id_fkey)
  • class_id → classes.class_id (scheduling_audit_log_class_id_fkey)
  • course_code → courses.course_code (scheduling_audit_log_course_code_fkey)
  • semester_id → semesters.semester_id (scheduling_audit_log_semester_id_fkey)
Field / PropTypeDefaultDescription
log_idrequired
uuidgen_random_uuid()**Primary Key**.
run_idrequired
uuid—Column `run_id` stored as `uuid`.
semester_id
uuid—Foreign key referencing `semesters.semester_id`.
batch_id
text—Foreign key referencing `batches.batch_id`.
execution_timerequired
timestamp with time zonenow()PostgreSQL UDT: `timestamptz`.
actionrequired
text—Column `action` stored as `text`.
class_id
uuid—Foreign key referencing `classes.class_id`.
reason
text—Column `reason` stored as `text`.
details
jsonb—Column `details` stored as `jsonb`.
course_coderequired
text—Foreign key referencing `courses.course_code`.

Was this page helpful?

Your feedback directly guides the engineering documentation roadmap.

On this page