Skip to content

DB Schema

Manish Joshi edited this page Nov 10, 2025 · 36 revisions
  1. Public Schema: Tables & Columns

Stores announcements to be sent to users.

Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
title text NULL
message text NULL
type text NULL
image_url text NULL
custom_icon text NULL
created_at timestamp with time zone NOT NULL, DEFAULT now()
send_at timestamp with time zone NULL
target_ids text[] NULL
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
created_by uuid NULL, FOREIGN KEY → public.user(id)
starts_at timestamp with time zone NOT NULL, DEFAULT now()
ends_at timestamp with time zone NULL
is_class_wise boolean NOT NULL, DEFAULT false
class_id uuid NOT NULL, FOREIGN KEY → public.class(id)
school_id uuid NOT NULL, FOREIGN KEY → public.school(id)
lesson_id uuid NOT NULL, FOREIGN KEY → public.lesson(id)
type text NULL
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
chapter_id uuid NULL, FOREIGN KEY → public.chapter(id)
course_id uuid NULL, FOREIGN KEY → public.course(id)
source text NULL
firebase_id text NULL
is_firebase boolean DEFAULT false
batch_id text NULL
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid(), FOREIGN KEY → public.user(id)
created_at timestamp with time zone NOT NULL, DEFAULT now()
is_deleted boolean DEFAULT false
lessons text NULL
updated_at timestamp without time zone DEFAULT now()
is_firebase boolean DEFAULT false
Column Name Data Type Constraints / Default
assignment_id uuid NOT NULL, FOREIGN KEY → public.assignment(id)
user_id uuid NOT NULL, FOREIGN KEY → public.user(id)
created_at timestamp with time zone DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
is_firebase boolean DEFAULT false
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
school_id uuid NOT NULL, FOREIGN KEY → public.school(id)
task_data jsonb NULL
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
name character varying NOT NULL
image text NULL
description text NULL
updated_at timestamp with time zone DEFAULT now()
created_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
name text NULL
image text NULL
course_id uuid NULL, FOREIGN KEY → public.course(id)
sort_index integer NULL
sub_topics text NULL
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
Column Name Data Type Constraints / Default
lesson_id uuid NOT NULL, FOREIGN KEY → public.lesson(id)
chapter_id uuid NOT NULL, FOREIGN KEY → public.chapter(id)
sort_index integer NULL
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
created_at timestamp with time zone NOT NULL, DEFAULT now()
chapter_id uuid NULL, FOREIGN KEY → public.chapter(id)
link text NULL
curriculum_id uuid NULL, FOREIGN KEY → public.curriculum(id)
course_id uuid NULL, FOREIGN KEY → public.course(id), DEFAULT gen_random_uuid()
grade_id uuid NULL, FOREIGN KEY → public.grade(id)
updated_at timestamp without time zone DEFAULT now()
is_deleted boolean DEFAULT false
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
chatbot_doc jsonb NULL
phonenumber text NOT NULL
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
name text NOT NULL
image text NULL
school_id uuid NOT NULL, FOREIGN KEY → public.school(id)
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
firebase_id text NULL
is_firebase boolean DEFAULT false
status text DEFAULT 'active'
is_ops boolean DEFAULT false
standard text NULL
academic_year text NULL
ops_created_by uuid NULL, FOREIGN KEY → public.user(id)
group_id text NULL
Column Name Data Type Constraints / Default
class_id uuid NOT NULL, FOREIGN KEY → public.class(id)
course_id uuid NOT NULL, FOREIGN KEY → public.course(id)
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
is_firebase boolean DEFAULT false
is_ops boolean DEFAULT false
ops_created_by uuid NULL, FOREIGN KEY → public.user(id)
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
code integer NOT NULL
expires_at timestamp with time zone NOT NULL
class_id uuid NOT NULL, FOREIGN KEY → public.class(id)
is_class_code boolean DEFAULT true
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
is_firebase boolean DEFAULT false
Column Name Data Type Constraints / Default
class_id uuid NOT NULL, FOREIGN KEY → public.class(id)
user_id uuid NOT NULL, FOREIGN KEY → public.user(id)
role USER-DEFINED NOT NULL
created_at timestamp with time zone DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
is_firebase boolean DEFAULT false
is_ops boolean DEFAULT false
ops_created_by uuid NULL, FOREIGN KEY → public.user(id)
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
email text NOT NULL
created_at timestamp with time zone DEFAULT now()
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
name character varying NOT NULL
image text NULL
description text NULL
sort_index integer NULL
subject_id uuid NULL, FOREIGN KEY → public.subject(id)
grade_id uuid NULL, FOREIGN KEY → public.grade(id)
curriculum_id uuid NULL, FOREIGN KEY → public.curriculum(id)
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
color text NULL
code text NULL
firebase_id text NULL
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
name character varying NOT NULL
image text NULL
description text NULL
sort_index integer NULL
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
firebase_id text NULL
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
lesson_id uuid NOT NULL, FOREIGN KEY → public.lesson(id)
user_id uuid NOT NULL, FOREIGN KEY → public.user(id)
created_at timestamp with time zone DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
is_firebase boolean DEFAULT false
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
name character varying NOT NULL
image text NULL
description text NULL
sort_index integer NULL
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
test text NULL
firebase_id text NULL
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
created_at timestamp with time zone NOT NULL, DEFAULT now()
student_id text NULL
result_id text NULL
firebase_id text NULL
is_firebase boolean NULL
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
name character varying NOT NULL
image text NULL
description text NULL
sort_index integer NULL
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
code text NULL
firebase_id text NULL
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
name text NULL
image text NULL
outcome text NULL
plugin_type text NULL
status text NULL
cocos_subject_code text NULL
cocos_chapter_code text NULL
created_by text NULL
subject_id uuid NULL, FOREIGN KEY → public.subject(id)
target_age_from integer NULL
target_age_to integer NULL
language_id uuid NULL, FOREIGN KEY → public.language(id)
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
cocos_lesson_id text NULL
color text NULL
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
created_at timestamp with time zone DEFAULT now()
results jsonb NULL
updated_at timestamp with time zone NULL
assignment_id uuid NOT NULL, FOREIGN KEY → public.assignment(id)
class_id uuid NOT NULL, FOREIGN KEY → public.class(id)
course_id uuid NOT NULL, FOREIGN KEY → public.course(id)
lesson_id uuid NOT NULL, FOREIGN KEY → public.lesson(id)
participants ARRAY NULL
is_deleted boolean DEFAULT false
school_id uuid NOT NULL, FOREIGN KEY → public.school(id)
starts_at timestamp with time zone NOT NULL
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
parent_id uuid NOT NULL, FOREIGN KEY → public.user(id)
student_id uuid NOT NULL, FOREIGN KEY → public.user(id)
created_at timestamp with time zone DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
is_firebase boolean DEFAULT false
is_ops boolean DEFAULT false
ops_created_by uuid FOREIGN KEY → public.user(id)
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
name text NOT NULL
program_type USER-DEFINED NULL
implementation_partner text NULL
funding_partner text NULL
institute_partner text NULL
country text NULL
state text NULL
district text NULL
block text NULL
cluster text NULL
village text NULL
institutes_count text NULL
students_count text NULL
devices_count text NULL
start_date date NULL
end_date date NULL
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone NOT NULL, DEFAULT now()
is_deleted boolean NULL
is_ops boolean NULL
model text NULL
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
user uuid FOREIGN KEY → public.user(id)
program_id uuid NOT NULL, FOREIGN KEY → public.program(id)
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone NOT NULL, DEFAULT now()
role USER-DEFINED NULL
is_deleted boolean NOT NULL, DEFAULT false
is_ops boolean NULL
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
user_id uuid FOREIGN KEY → public.user(id)
name text NULL
state text NULL
district text NULL
city text NULL
udise_id text NULL
is_resolved boolean DEFAULT false
created_at timestamp without time zone DEFAULT now()
updated_at timestamp without time zone DEFAULT now()
is_deleted boolean DEFAULT false
image text NULL
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
assignment_id uuid FOREIGN KEY → public.assignment(id)
lesson_id uuid FOREIGN KEY → public.lesson(id)
school_id uuid FOREIGN KEY → public.school(id)
score integer NULL
student_id uuid NOT NULL, FOREIGN KEY → public.user(id)
correct_moves integer NULL
time_spent integer NULL
wrong_moves integer NULL
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
course_id uuid FOREIGN KEY → public.course(id)
chapter_id uuid FOREIGN KEY → public.chapter(id)
class_id uuid FOREIGN KEY → public.class(id)
firebase_id text NULL
is_firebase boolean DEFAULT false
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
monthly text NULL
weekly text NULL
weeklySticker text NULL
year integer NOT NULL
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
accessory_name text NOT NULL
state_machine text NULL
state_number_input integer NULL
animation_name text NOT NULL
is_deleted boolean DEFAULT false
created_at timestamp without time zone DEFAULT now()
updated_at timestamp without time zone DEFAULT now()
state_input_name text NULL
type public.rive_type NOT NULL, DEFAULT 'normal'::rive_type
max_state_value bigint NOT NULL, DEFAULT 8
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
created_at timestamp without time zone DEFAULT now()
query text NOT NULL
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
name text NOT NULL
group1 text NULL
group2 text NULL
group3 text NULL
image text NULL
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
firebase_id text NULL
is_firebase boolean DEFAULT false
udise text NULL
group4 text NULL
academic_year text NULL
language_id uuid FOREIGN KEY → public.language(id)
student_login_type USER-DEFINED NULL
is_ops boolean DEFAULT false
program_id uuid FOREIGN KEY → public.program(id)
model USER-DEFINED NULL
address text NULL
ops_created_by uuid FOREIGN KEY → public.user(id)
status USER-DEFINED NULL
key_contacts jsonb NULL
whatsapp_bot_number text NULL
Column Name Data Type Constraints / Default
school_id uuid NOT NULL, FOREIGN KEY → public.school(id)
course_id uuid NOT NULL, FOREIGN KEY → public.course(id)
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
is_firebase boolean DEFAULT false
is_ops boolean DEFAULT false
ops_created_by uuid FOREIGN KEY → public.user(id)
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
school_name text NULL
district text NULL
village text NULL
udise_code text NULL
state text NULL
block text NULL
cluster text NULL
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp without time zone DEFAULT now()
instruction_medium text NULL
total_teachers integer NULL
pre_primary_section_available boolean NULL
school_type text NULL
classes text NULL
head_teachers text NULL
head_teacher text NULL
country text DEFAULT 'India'
Column Name Data Type Constraints / Default
school_id uuid NOT NULL, FOREIGN KEY → public.school(id)
user_id uuid NOT NULL, FOREIGN KEY → public.user(id)
role USER-DEFINED NOT NULL
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
is_firebase boolean DEFAULT false
is_ops boolean DEFAULT false
ops_created_by uuid FOREIGN KEY → public.user(id)
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
user_id uuid FOREIGN KEY → public.user(id), DEFAULT auth.uid()
is_deleted boolean NULL
role USER-DEFINED NULL
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
name character varying NOT NULL
image text NULL
description text NULL
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
name character varying NOT NULL
image text NULL
description text NULL
sort_index integer NULL
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
uploading_user uuid FOREIGN KEY → public.user(id)
start_time timestamp with time zone NULL
payload jsonb NOT NULL
status text DEFAULT 'pending'
error text NULL
process_started_at timestamp with time zone DEFAULT now()
batch_number bigint NULL
is_locked boolean DEFAULT false
locked_at timestamp with time zone NULL
locked_by text NULL
Column Name Data Type Constraints / Default
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
name text NULL
email text NULL
phone text NULL
gender text NULL
image text NULL
avatar text NULL
language_id uuid FOREIGN KEY → public.language(id)
curriculum_id uuid FOREIGN KEY → public.curriculum(id)
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
is_tc_accepted boolean DEFAULT false
age integer NULL
grade_id uuid FOREIGN KEY → public.grade(id)
music_off boolean DEFAULT false
sfx_off boolean DEFAULT false
fcm_token text NULL
student_id text NULL
firebase_id text NULL
is_firebase boolean DEFAULT false
is_ops boolean DEFAULT false
stars integer NULL
learning_path text NULL
ops_created_by uuid public.user(id)
reward text NULL
Column Name Data Type Constraints / Default
user_id uuid NOT NULL, FOREIGN KEY → public.user(id)
badge_id uuid NOT NULL, FOREIGN KEY → public.badge(id)
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
is_seen boolean NULL
is_firebase boolean DEFAULT false
Column Name Data Type Constraints / Default
user_id uuid NOT NULL, FOREIGN KEY → public.user(id)
bonus_id uuid NOT NULL, FOREIGN KEY → public.lesson(id)
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
is_seen boolean NULL
is_firebase boolean DEFAULT false
Column Name Data Type Constraints / Default
user_id uuid NOT NULL, FOREIGN KEY → public.user(id)
course_id uuid NOT NULL, FOREIGN KEY → public.course(id)
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
is_firebase boolean DEFAULT false
Column Name Data Type Constraints / Default
user_id uuid NOT NULL, FOREIGN KEY → public.user(id)
sticker_id uuid NOT NULL, FOREIGN KEY → public.sticker(id)
created_at timestamp with time zone NOT NULL, DEFAULT now()
updated_at timestamp with time zone DEFAULT now()
is_deleted boolean DEFAULT false
id uuid NOT NULL, PRIMARY KEY, DEFAULT gen_random_uuid()
is_seen boolean NULL
is_firebase boolean DEFAULT false
  1. Database Tables Explained

public.announcement

Stores announcements to be sent to users — for example, notifications about new assignments, upcoming quizzes, reminders.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid().
    Unique ID for each announcement.

  • titletext — Short headline for the announcement.
    Example: "Holi Announcement ✅✅✅"

  • messagetext — Detailed body or content of the announcement.
    Example: "On the event of Holi, we plan to celebrate in the Stadium."

  • typetext — Category or purpose of the announcement, such as 'assignment', 'liveQuiz'.

  • image_urltext — URL for an optional image to display with the announcement.
    Example: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Golde33443.jpg/640px-Golde33443.jpg"

  • custom_icontext — Identifier for a custom icon to use instead of a default icon.
    Example: "ic_stat_test_icon_for_19feb_v_25"

  • created_attimestamp with time zoneNOT NULL, Default: now().
    Timestamp indicating when the announcement was created.

  • send_attimestamp with time zone — Optional scheduled date/time when the announcement should be sent or become visible.

  • target_idsARRAY — Array of class IDs that should receive this announcement.
    Example: [ "ccc55fb6-65cd-40f3-8301-91a4d9aa9bec", "59c52dbd-f920-4873-b548-6b4ebaa17cb1", "ae267303-6afb-4cab-bce9-6109bca82ed8" ]


public.assignment

Stores assignments given to students. Assignments can be regular homework, live quizzes, or any activity that students need to complete within a time window.

This table makes it easy for schools and teachers to track who created the assignment, who should receive it, and what lesson or course it belongs to.


  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid().
    Unique ID for each assignment record.

  • created_byuuidForeign Key → public.user(id).
    ID of the teacher or admin who created the assignment.

  • starts_attimestamp with time zoneNOT NULL, Default: now().
    The date and time when the assignment becomes active and visible to students.

  • ends_attimestamp with time zone — Due date for the assignment.
    Defines when the assignment must be played by the student. After this timestamp, the assignment is considered closed and students can no longer play the assignment.

  • is_class_wisebooleanNOT NULL, Default: false.
    If true, the assignment is sent to an entire class; if false, it can be sent to specific students only.

  • class_iduuidNOT NULL, Foreign Key → public.class(id).
    The class this assignment is linked to.

  • school_iduuidNOT NULL, Foreign Key → public.school(id).
    The school that owns this assignment record.

  • lesson_iduuidNOT NULL, Foreign Key → public.lesson(id).
    The lesson content that this assignment refers to.

  • typetext — Type or category of assignment.
    Examples include 'assignment', 'liveQuiz'.

  • created_attimestamp with time zoneNOT NULL, Default: now().
    The timestamp when the assignment was created.

  • updated_attimestamp with time zone — Default: now().
    Tracks the last time this assignment was updated.

  • is_deletedboolean — Default: false.
    Soft-delete flag — if true, the assignment is hidden but not permanently removed from the database.

  • chapter_iduuidForeign Key → public.chapter(id).
    The chapter to which this assignment belongs, if applicable.

  • course_iduuidForeign Key → public.course(id).
    The course related to this assignment, if relevant.

  • sourcetext — The source of creation for the assignment, e.g., 'chatbot'.

  • firebase_idtext — ID of the assignment in Firebase, if this assignment was synced from Firebase.

  • is_firebaseboolean — Default: false.
    true if this record was imported or synced from Firebase.

  • batch_idtext — Optional batch identifier for grouped assignments.
    Used to group multiple assignments that were created in one action. Enables tracking assignment sets and generating deep links that point to grouped assignments.


public.assignment_cart

Temporary storage for a user’s selected lessons before assigning them — like a draft workspace for a teacher.

  • iduuid — Unique ID for this cart. Also FK → public.user(id); links the cart to its owner.
  • created_attimestamp with time zone — When the cart was created.
  • is_deletedboolean — Marks the cart as soft-deleted if true.
  • lessonstext — Stores the list of lesson IDs in the cart (usually a JSON array).
  • updated_attimestamp without time zone — Last time the cart was updated.
  • is_firebasebooleantrue if the cart was synced from Firebase.

public.assignment_user

Links an assignment to individual students — tracks which student gets which work.

  • iduuid — Unique ID for this link record.
  • assignment_iduuid — FK → public.assignment(id); the assignment being given.
  • user_iduuid — FK → public.user(id); the student’s ID — the student who the teacher assigned this assignment to.
  • created_attimestamp with time zone — When this link was created.
  • updated_attimestamp with time zone — When this link was last updated.
  • is_deletedboolean — Soft-delete flag.
  • is_firebasebooleantrue if synced from Firebase.

public.auto_chatbot

Stores automated chatbot tasks — used for scheduling tasks and messages school-wise.

  • iduuid — Unique ID for this chatbot task.
  • school_iduuid — FK → public.school(id); identifies which school this task belongs to for scheduling.
  • task_datajsonb — Stores the JSON details for the chatbot’s actions for that school — like timing, content, and rules.
    Example: [ {"tasks": {"0": ["sendReports", "reminder"], "1": ["assign", "sendReports"], "2": ["sendReports"], "3": ["assign"], "4": [], "5": [], "6": []}, "assignPerDay": null, "maxAssignmentPerDay": 8, "programDurationInWeeks": 10}]
  • created_attimestamp with time zone — When the task was created.
  • updated_attimestamp with time zone — When it was last updated.
  • is_deletedboolean — Marks the task as soft-deleted if true.

public.badge

Stores details about badges for gamification — to reward students.

  • iduuid — Unique ID for this badge.
  • namecharacter varyingBadge name — what the badge is called.
  • imagetext — URL for the badge image.
  • descriptiontext — Description about the badge — what it means or how to earn it.
  • created_attimestamp with time zone — When the badge was created.
  • updated_attimestamp with time zone — When it was last updated.
  • is_deletedboolean — Soft-delete flag.

public.chapter

Stores course chapters — each chapter is a section of a course that contains multiple lessons.

  • iduuid
    Unique ID for the chapter.
    Primary Key, NOT NULL, Default: gen_random_uuid().
    Example: 5f7e5b88-1b62-4f27-b6ec-7a9bbcd90b22

  • nametext
    Title of the chapter.
    Example: "Fractions and Decimals"

  • imagetext
    URL of an image representing the chapter.
    Example: https://cdn.example.com/images/chapter1.png

  • course_iduuid
    References the course this chapter belongs to.
    Foreign Key → public.course(id)
    Example: c9a8f8d2-6e34-4c12-9b0f-3e60b6b9e8ab

  • sort_indexinteger
    Defines the order of the chapter within the course.
    Starts from 0 (first chapter = 0, second = 1, ...).
    Example: 0

  • sub_topicstext
    Serialized list of sub-topics under this chapter.
    Example: ["Fractions Basics", "Adding Fractions"]

  • created_attimestamp with time zone
    When the chapter was created.
    NOT NULL, Default: now()
    Example: 2025-07-02T12:34:56Z

  • updated_attimestamp with time zone
    When the chapter was last updated.
    Default: now()
    Example: 2025-07-02T12:34:56Z

  • is_deletedboolean
    Soft delete flag — true means this chapter is hidden but not removed.
    Default: false


public.chapter_lesson

Links lessons to chapters — defines which lessons belong to which chapters, and in what order.

  • iduuid
    Unique ID for this mapping.
    Primary Key, NOT NULL, Default: gen_random_uuid()
    Example: 1c2e7d2f-6df2-42a8-b4ee-61eb2329fabb

  • lesson_iduuid
    Lesson being linked to the chapter.
    NOT NULL, Foreign Key → public.lesson(id)
    Example: 9b91b22e-4668-4ae1-8f26-123b5e4c5678

  • chapter_iduuid
    Chapter the lesson is linked to.
    NOT NULL, Foreign Key → public.chapter(id)
    Example: 5f7e5b88-1b62-4f27-b6ec-7a9bbcd90b22

  • sort_indexinteger
    Defines the lesson’s order within the chapter.
    Starts from 0 (first lesson = 0).
    Example: 1

  • created_attimestamp with time zone
    When this link was created.
    NOT NULL, Default: now()
    Example: 2025-07-02T12:34:56Z

  • updated_attimestamp with time zone
    When this link was last updated.
    Default: now()
    Example: 2025-07-02T12:34:56Z

  • is_deletedboolean
    Soft delete flag — true means the record is marked as deleted (logically removed) but is not physically deleted from the database.
    Default: false


public.chapter_links

Stores external links related to chapters — for example, QR links.

  • iduuid
    Unique ID for the external link.
    Primary Key, NOT NULL, Default: gen_random_uuid()
    Example: 2e46b055-f42b-43b8-9b2c-9f1e5e84ec98

  • created_attimestamp with time zone
    When the link was created.
    NOT NULL, Default: now()
    Example: 2025-07-02T12:34:56Z

  • chapter_iduuid
    Chapter this link is associated with.
    Foreign Key → public.chapter(id)
    Example: 5f7e5b88-1b62-4f27-b6ec-7a9bbcd90b22

  • linktext
    The external URL or resource link.
    Example: https://www.youtube.com/watch?v=dQw4w9WgXcQ

  • curriculum_iduuid
    The curriculum this link and chapter is related to.
    Foreign Key → public.curriculum(id)
    Example: f8c2765a-5d1d-47d5-8d47-1e897e3219e3

  • course_iduuid
    The course this link and chapter is related to.
    Foreign Key → public.course(id)
    Example: c9a8f8d2-6e34-4c12-9b0f-3e60b6b9e8ab

  • grade_iduuid
    The grade level this link is related to.
    Foreign Key → public.grade(id)
    Example: 2a6db1c3-b421-4dc5-8ee0-71d1f65bd2e0

  • updated_attimestamp without time zone
    When the link was last updated.
    Default: now()
    Example: 2025-07-02T12:34:56Z

  • is_deletedboolean
    Soft delete flag — true means the record is marked as deleted (logically removed) but is not physically deleted from the database.
    Default: false


public.chatbot

Stores general chatbot configuration and payload data.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid()
  • created_attimestamp with time zone — NOT NULL, Default: now()
  • updated_attimestamp with time zone — Default: now()
  • is_deletedboolean — Default: false
  • chatbot_docjsonb — JSON document for chatbot logic.
  • phonenumbertext — NOT NULL. Associated phone number(Example., 919876543210).

public.class

Stores each class within a school.
Classes must follow the naming convention: number + optional section — for example, '1', '1A', '2B'.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid().
    Unique ID for the class.
  • nametext — NOT NULL. Name of the class, following the format above.
    Example: '1', '1A', '2B'
  • imagetext — Optional image/icon URL for the class.
    Example: 'https://cdn.schoolapp.com/class-1A.png'
  • school_iduuid — NOT NULL. FK → public.school(id).
    Which school owns this class.
  • created_attimestamp with time zone — NOT NULL, Default: now().
    When the class was created.
  • updated_attimestamp with time zone — Default: now().
    Last updated timestamp.
  • is_deletedboolean — Default: false.
    Soft delete — true means the class is hidden but remains in the DB.
  • firebase_idtext — If synced with Firebase, the Firebase ID.
  • is_firebaseboolean — Default: false.
    true if imported/synced from Firebase.
  • statustext — Default: 'active'.
    Example: 'active' means currently running; 'migrated' means the class has moved to the next academic year, and a new 'active' class replaces it.
  • is_opsboolean — Default: false.
    Marks if the class was created by the operations/admin team.
  • standardtext — The grade level for this class.
    Example: '1', '2'
  • academic_yeartext — The academic year this class belongs to.
    Example: '2024-2025'
  • ops_created_byuuid — FK → public.user(id).
    Which ops user created it.
  • group_idtext — WhatsApp group ID for this class.
    Example: '12034567890-123456789@g.us'

public.class_course

Connects a class to its courses.
For example, Class 1A → English, Maths, Science.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid().
  • class_iduuid — NOT NULL. FK → public.class(id).
    The class that has this course.
  • course_iduuid — NOT NULL. FK → public.course(id).
    The course being taught.
  • created_attimestamp with time zone — NOT NULL, Default: now().
  • updated_attimestamp with time zone — Default: now().
  • is_deletedboolean — Default: false.
  • is_firebaseboolean — Default: false.
  • is_opsboolean — Default: false.
  • ops_created_byuuid — FK → public.user(id).
    The ops/admin user who linked this course.

public.class_invite_code

Holds invite codes students can use to join a class.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid().
  • codeinteger — NOT NULL. 6-digit numeric code.
    Students enter this to join a class.
    Example: 123456
  • expires_attimestamp with time zone — NOT NULL. When the code expires.
    After this time, the code won’t work.
  • class_iduuid — NOT NULL. FK → public.class(id).
    The class this code is for.
  • is_class_codeboolean — Default: true. Marks that this code is class-level.
  • created_attimestamp with time zone — NOT NULL, Default: now().
  • updated_attimestamp with time zone — Default: now().
  • is_deletedboolean — Default: false.
  • is_firebaseboolean — Default: false.

public.class_user

Maps users to classes, defining what role they play.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid().
  • class_iduuid — NOT NULL. FK → public.class(id).
    The class they belong to.
  • user_iduuid — NOT NULL. FK → public.user(id).
    The user — could be a student, teacher, or parent.
  • roleUSER-DEFINED — NOT NULL. Defines the user’s role in this class.
    Examples:
    • 'student' → a learner enrolled in this class
    • 'teacher' → the teacher who manages this class
    • 'parent' → linked parent/guardian for a student
  • created_attimestamp with time zone — Default: now(). When they were linked.
  • updated_attimestamp with time zone — Default: now(). Last update.
  • is_deletedboolean — Default: false. Soft delete flag.
  • is_firebaseboolean — Default: false. true means the record came from Firebase.
  • is_opsboolean — Default: false. Marks if added by ops team.
  • ops_created_byuuid — FK → public.user(id).
    Ops user who added the record, if applicable.

Example:
A student Amit (user_id) is linked as 'student' to Class 1A.
His mother Meera (user_id) might be linked with the same class_id but as 'parent'.
The teacher Mrs. Sharma (user_id) is linked with the same class_id as 'teacher'.


public.connector_users

Stores user information for a connector service.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid()
  • emailtext — NOT NULL, UNIQUE. User’s email which is there in user table(Example., abc@gmail.com).
  • created_attimestamp with time zone — Default: now()

public.course

Stores details about courses — each course groups chapters and lessons under a subject and grade.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid().
    Unique ID for this course.
  • namecharacter varying — NOT NULL. Name of the course.
    Example: 'English', 'Maths'
  • imagetext — URL for an optional course image.
    Example: 'https://cdn.schoolapp.com/courses/english-5.png'
  • descriptiontext — Short description of what the course covers.
    Example: 'Covers grammar, comprehension, and writing skills for Grade 5.'
  • sort_indexinteger — Used to order courses in the app UI.
    Starts from 0 and increments.
  • subject_iduuid — FK → public.subject(id).
    Links to the subject this course belongs to.
  • grade_iduuid — FK → public.grade(id).
    Defines which grade/standard this course is for.
  • curriculum_iduuid — FK → public.curriculum(id).
    Which curriculum this course follows.
  • created_attimestamp with time zone — NOT NULL, Default: now().
    When this course was created.
  • updated_attimestamp with time zone — Default: now().
    Last time the course was updated.
  • is_deletedboolean — Default: false.
    true means soft-deleted — but still in the database.
  • colortext — A hex color code for UI styling.
    Example: '#FF5733'
  • codetext — Unique short code for the course.
    Example: 'ENG-G5-2025'
  • firebase_idtext — Unique ID if this course was synced from Firebase.

public.curriculum

Stores details about educational curricula — for example, NCERT, State Board, or Karnataka.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid().
    Unique ID for the curriculum.
  • namecharacter varying — NOT NULL. Name of the curriculum.
    Example: 'NCERT', 'Maharashtra State Board'
  • imagetext — URL for an optional icon or logo.
    Example: 'https://cdn.schoolapp.com/curricula/ncert.png'
  • descriptiontext — Short description about this curriculum.
    Example: 'Central Board syllabus for Indian schools.'
  • sort_indexinteger — Used for ordering in UI lists.
    Starts at 0 and increments.
  • created_attimestamp with time zone — NOT NULL, Default: now().
    When the curriculum was added.
  • updated_attimestamp with time zone — Default: now().
    Last time it was updated.
  • is_deletedboolean — Default: false.
    true means the record is soft-deleted.
  • firebase_idtext — Firebase ID if synced.

public.favorite_lesson

Maps which lessons a user has marked as favorite — for faster access later.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid().
    Unique ID for the favorite record.
  • lesson_iduuid — NOT NULL. FK → public.lesson(id).
    Lesson that’s marked favorite.
    Example: '9b1b2a73-54d3-4321-b1a2-7e9b2a3c4f5d'
  • user_iduuid — NOT NULL. FK → public.user(id).
    User who favorited this lesson.
  • created_attimestamp with time zone — Default: now().
    When it was favorited.
  • updated_attimestamp with time zone — Default: now().
    When last updated.
  • is_deletedboolean — Default: false.
    true = soft deleted, still stored.
  • is_firebaseboolean — Default: false.
    If synced from Firebase.

public.grade

Stores school grades — Grade 1, Grade 2 etc.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid().
    Unique grade ID.
  • namecharacter varying — NOT NULL. Grade name.
    Example: 'Grade 2'
  • imagetext — URL for a grade icon.
    Example: 'https://cdn.schoolapp.com/grades/grade-2.png'
  • descriptiontext — Short description.
    Example: 'Basic level for students aged 6-7'
  • sort_indexinteger — UI order. Starts from 0.
    Example: 0 for Grade 1, 1 for Grade 2.
  • created_attimestamp with time zone — NOT NULL, Default: now().
    When created.
  • updated_attimestamp with time zone — Default: now().
    Last update timestamp.
  • is_deletedboolean — Default: false.
    true means hidden.
  • testtext — Optional test/debug field.
  • firebase_idtext — Firebase ID if synced.

public.issue_debug

Helps devs track bugs — stores debug data for user-reported issues.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid().
    Unique ID for the debug record.
  • created_attimestamp with time zone — NOT NULL, Default: now().
    When the log was created.
  • student_idtext — ID of the affected student.
    Example: 'ab959b86-fb41-494b-89d9-99f71abc0828'
  • result_idtext — Related result ID.
    Example: 'a8d5414c-6d9c-4eae-9cd7-a70782ebba08'
  • firebase_idtext — Firebase ID if synced.
  • is_firebasebooleantrue = synced from Firebase.

public.language

Defines all languages offered for content, quizzes, or the app itself.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid().
    Unique ID for the language.
  • namecharacter varying — NOT NULL. Language name.
    Example: 'English', 'ಕನ್ನಡ'
  • imagetext — Flag or icon.
    Example: 'https://cdn.schoolapp.com/flags/en.png'
  • descriptiontext — Short info.
    Example: 'English language for all modules'
  • sort_indexinteger — UI display order. Starts from 0.
    Example: 0 for 'English', 1 for 'Hindi'.
  • created_attimestamp with time zone — NOT NULL, Default: now().
    When added.
  • updated_attimestamp with time zone — Default: now().
    Last update timestamp.
  • is_deletedboolean — Default: false.
    Soft delete flag.
  • codetext — Language code (ISO).
    Example: 'en', 'hi', 'kn'
  • firebase_idtext — Firebase ID if any.

public.lesson

Stores lessons — e.g., alphabets, addition, activities for students.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid().
    Unique lesson ID.
  • nametext — Name of the lesson.
    Example: 'Addition Basics'
  • imagetext — URL for thumbnail.
    Example: 'https://cdn.schoolapp.com/lessons/addition-basics.png'
  • outcometext — Learning goal.
    Example: 'Students understand basic addition up to 20'
  • plugin_typetext — How it runs.
    Example: 'cocos'
  • statustext — Status flag.
    Example: 'approved'
  • cocos_subject_codetext — Cocos-specific code. Example: 'en'
  • cocos_chapter_codetext — Cocos-specific code. Example: 'en00'
  • created_bytext — Author or creator.
    Example: 'teacher_abc'
  • subject_iduuid — FK → public.subject(id).
    Subject it belongs to.
  • target_age_frominteger — Minimum age.
    Example: 5
  • target_age_tointeger — Maximum age.
    Example: 7
  • language_iduuid — FK → public.language(id).
    Lesson language.
  • created_attimestamp with time zone — NOT NULL, Default: now().
    Created on.
  • updated_attimestamp with time zone — Default: now().
    Last updated.
  • is_deletedboolean — Default: false.
    Soft delete flag.
  • cocos_lesson_idtext — Cocos ID if linked. Example: 'en0005'
  • colortext — UI color hex.
    Example: '#33CCFF'

public.live_quiz_room

Stores live quiz room details for students doing quizzes together or individual.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid().
    Unique quiz room ID.
  • created_attimestamp with time zone — Default: now().
    When quiz room was created.
  • resultsjsonb — JSON result map.
    Example: { "student1": 10, "student2": 8 }
  • updated_attimestamp with time zone — Last updated timestamp.
  • assignment_iduuid — NOT NULL. FK → public.assignment(id).
    Assignment or quiz this room or session belongs to.
  • class_iduuid — NOT NULL. FK → public.class(id).
    Class doing this quiz.
  • course_iduuid — NOT NULL. FK → public.course(id).
    Related course.
  • lesson_iduuid — NOT NULL. FK → public.lesson(id).
    Lesson of the quiz.
  • participantsARRAY — List of participant IDs.
    Example: ['d0f73c0f-cf9e-4676-b147-b87104e5708f', 'd0f73c0f-cf9e-4676-b147-b87104e5708f']
  • is_deletedboolean — Default: false.
    Soft delete flag.
  • school_iduuid — NOT NULL. FK → public.school(id).
    School that ran the quiz.
  • starts_attimestamp with time zone — NOT NULL.
    Start time of the quiz room.
    Example: '2025-07-03T12:00:00Z'

public.parent_user

Links parent users to their children (students).
One row means one parent–child relationship.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid()
    Unique ID for this parent-child link. Example: 'b1a2c3d4-5678-90ef-abcd-1234567890ab'

  • parent_iduuid — NOT NULL. FK → (parent) public.user(id).
    The parent’s user ID.
    Example: '1e2d3c4b-5678-90ab-cdef-1234567890ab'

  • student_iduuid — NOT NULL. FK → (student) public.user(id).
    The child’s user ID.
    Example: '2f3e4d5c-6789-01bc-def0-2345678901bc'

  • created_attimestamp with time zone — Default: now()
    When this parent-child link was created. Example: '2024-07-01T12:00:00+00:00'

  • updated_attimestamp with time zone — Default: now()
    Last update time for this link. Example: '2024-07-02T09:30:00+00:00'

  • is_deletedboolean — Default: false
    Soft delete flag. true means hidden, not removed from DB. Example: false

  • is_firebaseboolean — Default: false
    true means synced from Firebase. Example: false

  • is_opsboolean — Default: false
    true if created by an operations user. Example: false

  • ops_created_byuuid — FK → public.user(id)(https://github.com/chimple/cuba/wiki/DB-Schema#publicuser)
    The ops user who created this link. Example: '3c4d5e6f-7890-12ab-cdef-3456789012cd'


public.program

Stores information about high-level educational programs or initiatives.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid()
    Unique ID for this program.
    Example: 'a1b2c3d4-5678-90ab-cdef-1234567890ab'

  • nametext — NOT NULL. The name of the program.
    Example: 'Digital Learning Initiative 2024'

  • program_typeUSER-DEFINED — The type of program.
    Example: 'Government', 'CSR', 'private'

  • implementation_partnertext — Organization that implements the program.
    Example: 'ABC Foundation'

  • funding_partnertext — Organization providing funding.
    Example: 'XYZ Bank CSR'

  • institute_partnertext — Related educational institute or training partner.
    Example: 'DEF University'

  • countrytext — Country where the program is active.
    Example: 'India'

  • statetext — State/region of the program.
    Example: 'Karnataka'

  • districttext — District of operation.
    Example: 'Bangalore Urban'

  • blocktext — Sub-district block.
    Example: 'Block A'

  • clustertext — Specific cluster under the block.
    Example: 'Cluster 3'

  • villagetext — Village or community covered.
    Example: 'Marathahalli'

  • institutes_counttext — Number of institutes covered.
    Example: '15'

  • students_counttext — Number of students enrolled.
    Example: '2500'

  • devices_counttext — Number of devices deployed.
    Example: '500'

  • start_datedate — Start date of the program.
    Example: '2024-06-01'

  • end_datedate — End date of the program.
    Example: '2025-05-31'

  • created_attimestamp with time zone — NOT NULL, Default: now()
    When the program record was created. Example: '2024-07-01T12:00:00+00:00'

  • updated_attimestamp with time zone — NOT NULL, Default: now()
    Last updated. Example: '2024-07-02T12:00:00+00:00'

  • is_deletedboolean — Soft delete flag.
    true means hidden but not removed. Example: false

  • is_opsbooleantrue if created by ops user. Example: false

  • modeltext — The operating model or delivery model.
    Example: 'Hybrid'


public.program_user

Links users to specific programs and defines their role in that program.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid()
    Unique ID for this link.
    Example: '9f8e7d6c-5432-10ab-cdef-0987654321ab'

  • useruuid — FK → public.user(id)
    The user who is part of the program.
    Example: '123e4567-e89b-12d3-a456-426614174000'

  • program_iduuid — NOT NULL. FK → public.program(id)
    The program they are linked to.
    Example: 'a1b2c3d4-5678-90ab-cdef-1234567890ab'

  • created_attimestamp with time zone — NOT NULL, Default: now()
    When this link was created.
    Example: '2024-07-01T12:00:00+00:00'

  • updated_attimestamp with time zone — NOT NULL, Default: now()
    When this link was last updated.
    Example: '2024-07-02T12:30:00+00:00'

  • roleUSER-DEFINED — User’s role within the program.
    Example: 'program_manager', 'field_coordinator'

    program_manager — A manager responsible for a program.

    • Has access only to the schools that are connected to the program they manage
    • Cannot access schools outside of the program scope

    field_coordinator — A coordinator working under a program.

    • Assigned to specific schools within a block
    • Has access only to the schools they are directly assigned to
  • is_deletedboolean — NOT NULL, Default: false
    Soft delete flag — true means marked deleted but kept for history.
    Example: false

  • is_opsbooleantrue if this link was added by an ops user.
    Example: false


public.req_new_school

Stores requests from users to add a new school — used for moderation before approval.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid()
    Unique ID for this request.
    Example: 'abc12345-def6-7890-gh12-ijklmnopqrst'

  • user_iduuid — FK → public.user(id)
    The user who made the request.
    Example: '123e4567-e89b-12d3-a456-426614174000'

  • nametext — Name of the requested school.
    Example: 'Government Primary School No. 5'

  • statetext — State where the school is located.
    Example: 'Maharashtra'

  • districttext — District where the school is located.
    Example: 'Pune'

  • citytext — City or town of the school.
    Example: 'Pimpri-Chinchwad'

  • udise_idtext — The UDISE ID if provided.
    Example: '27251400105'

  • is_resolvedboolean — Default: false
    true means this request has been reviewed and handled.
    Example: false

  • created_attimestamp without time zone — Default: now()
    When the request was made.
    Example: '2024-07-02T09:15:00'

  • updated_attimestamp without time zone — Default: now()
    When the request was last updated.
    Example: '2024-07-03T10:00:00'

  • is_deletedboolean — Default: false
    Soft delete — if true, this request is hidden but not removed.
    Example: false

  • imagetext — URL to an image or document uploaded with the request.
    Example: 'https://mycdn.com/uploads/request-doc.png'


public.result

Stores the outcome of a student’s lesson or assignment attempt — tracks score, time, and performance.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid()
    Unique result record ID.
    Example: '789e1234-ab56-7890-cd12-efgh34567890'

  • assignment_iduuid — FK → public.assignment(id)
    Assignment this result belongs to (if applicable).
    Example: '111e2222-ab33-4444-bc55-666677778888'

  • lesson_iduuid — FK → public.lesson(id)
    The lesson the student played.
    Example: '222e3333-bb44-5555-cc66-777788889999'

  • school_iduuid — FK → public.school(id)
    School the student belonged to during this attempt.
    Example: '333e4444-cc55-6666-dd77-888899990000'

  • scoreinteger — The score achieved by the student.
    Example: 85

  • student_iduuid — NOT NULL, FK → public.user(id)
    The student who attempted the lesson.
    Example: '444e5555-dd66-7777-ee88-999900001111'

  • correct_movesinteger — Number of correct actions/answers.
    Example: 15

  • time_spentinteger — Total time spent, in seconds.
    Example: 300 (5 minutes)

  • wrong_movesinteger — Number of wrong answers/moves.
    Example: 2

  • created_attimestamp with time zone — NOT NULL, Default: now()
    When this result was recorded.
    Example: '2024-07-02T11:45:00Z'

  • updated_attimestamp with time zone — Default: now()
    When this result was last updated.
    Example: '2024-07-02T11:50:00Z'

  • is_deletedboolean — Default: false
    Soft delete flag — true means hidden, not removed.
    Example: false

  • course_iduuid — FK → public.course(id)
    Related course.
    Example: '555e6666-ee77-8888-ff99-000011112222'

  • chapter_iduuid — FK → public.chapter(id)
    Related chapter.
    Example: '666e7777-ff88-9999-aa00-111122223333'

  • class_iduuid — FK → public.class(id)
    Class the student was enrolled in.
    Example: '777e8888-gg99-0000-bb11-222233334444'

  • firebase_idtext — Firebase ID if synced.
    Example: 'firebase_result_123456'

  • is_firebaseboolean — Default: false
    true if this result came from Firebase sync.
    Example: true


public.reward

Stores periodic reward info for gamification — like weekly/monthly rewards.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid()
    Unique reward record ID.
    Example: 'abc12345-def6-7890-gh12-ijk345678901'

  • created_attimestamp with time zone — NOT NULL, Default: now()
    When this reward entry was created.
    Example: '2025-07-02T09:00:00Z'

  • updated_attimestamp with time zone — Default: now()
    Last time this reward entry was updated.
    Example: '2025-07-02T09:30:00Z'

  • is_deletedboolean — Default: false
    Soft delete flag — true means hidden, not removed.
    Example: false

  • monthlytext — Info or ID for the monthly bonus reward.
    Example: {"monthly": {"1": [{"id": "0bddcc47-1d7d-438d-a612-a7ba233cb205", "type": "bonus"}], "2": [{"id": "49603369-0db7-4949-bdfb-7d3b4697eab3", "type": "bonus"}], "3": [{"id": "e538cc03-b136-48b2-9af8-45f7a425311b", "type": "bonus"}], "4": [{"id": "e5f0a1fa-6058-4703-aaa4-ad5c46b37261", "type": "bonus"}], "5": [{"id": "510f02bb-ecb3-4320-b7c1-1be81bf94013", "type": "bonus"}], "6": [{"id": "b06fa520-72e6-4ee3-9fd5-236640d30db2", "type": "bonus"}], "7": [{"id": "89a937d7-84da-484d-a494-1b3f1e91fef9", "type": "bonus"}], "8": [{"id": "94abe5bf-f7f4-4d31-a5cf-6795090e0246", "type": "bonus"}], "9": [{"id": "5e7eb19a-0cf0-4436-b4b1-f544ad90560e", "type": "bonus"}], "10": [{"id": "5f0b5e59-9268-4722-8a89-a8b3971d2b7b", "type": "bonus"}], "11": [{"id": "26105b58-8872-4c5d-986b-fd08cc5632c4", "type": "bonus"}], "12": [{"id": "cf1be8c5-8422-404d-b49c-18224034bf92", "type": "bonus"}]}}}

  • weeklytext — Info or ID for the weekly badge reward.
    Example: {"weekly": {"1": [{"id": "0bddcc47-1d7d-438d-a612-a7ba233cb205", "type": "badge"}], "2": [{"id": "49603369-0db7-4949-bdfb-7d3b4697eab3", "type": "badge"}], "3": [{"id": "e538cc03-b136-48b2-9af8-45f7a425311b", "type": "badge"}], "4": [{"id": "e5f0a1fa-6058-4703-aaa4-ad5c46b37261", "type": "badge"}], "5": [{"id": "510f02bb-ecb3-4320-b7c1-1be81bf94013", "type": "badge"}], "6": [{"id": "b06fa520-72e6-4ee3-9fd5-236640d30db2", "type": "badge"}], "7": [{"id": "89a937d7-84da-484d-a494-1b3f1e91fef9", "type": "badge"}], "8": [{"id": "94abe5bf-f7f4-4d31-a5cf-6795090e0246", "type": "badge"}], "9": [{"id": "5e7eb19a-0cf0-4436-b4b1-f544ad90560e", "type": "badge"}], "10": [{"id": "5f0b5e59-9268-4722-8a89-a8b3971d2b7b", "type": "badge"}], "11": [{"id": "26105b58-8872-4c5d-986b-fd08cc5632c4", "type": "badge"}], "12": [{"id": "cf1be8c5-8422-404d-b49c-18224034bf92", "type": "badge"}]}}}

  • weeklyStickertext — Info or ID for the weekly sticker reward.
    Example: ' {"weeklySticker": {"1": [{"id": "0bddcc47-1d7d-438d-a612-a7ba233cb205", "type": "sticker"}], "2": [{"id": "49603369-0db7-4949-bdfb-7d3b4697eab3", "type": "sticker"}], "3": [{"id": "e538cc03-b136-48b2-9af8-45f7a425311b", "type": "sticker"}], "4": [{"id": "e5f0a1fa-6058-4703-aaa4-ad5c46b37261", "type": "sticker"}], "5": [{"id": "510f02bb-ecb3-4320-b7c1-1be81bf94013", "type": "sticker"}], "6": [{"id": "b06fa520-72e6-4ee3-9fd5-236640d30db2", "type": "sticker"}], "7": [{"id": "89a937d7-84da-484d-a494-1b3f1e91fef9", "type": "sticker"}], "8": [{"id": "94abe5bf-f7f4-4d31-a5cf-6795090e0246", "type": "sticker"}], "9": [{"id": "5e7eb19a-0cf0-4436-b4b1-f544ad90560e", "type": "sticker"}], "10": [{"id": "5f0b5e59-9268-4722-8a89-a8b3971d2b7b", "type": "sticker"}], "11": [{"id": "26105b58-8872-4c5d-986b-fd08cc5632c4", "type": "sticker"}], "12": [{"id": "cf1be8c5-8422-404d-b49c-18224034bf92", "type": "sticker"}]}}}'

  • yearinteger — NOT NULL. The year these rewards apply to.
    Example: 2025


public.rive_reward

Stores metadata for Rive animation rewards such as accessories, states, and animations used in the app.

  • iduuidPrimary Key, NOT NULL, Default: extensions.uuid_generate_v4()
    Unique identifier for each reward entry.
    Example: 'bccb729a-299b-48ff-af5a-5bd1e476dde6'

  • accessory_nametext — NOT NULL
    Name of the accessory or item associated with the Rive animation.
    Example: 'YellowHat'

  • state_machinetext
    Name of the Rive state machine controlling animation logic.
    Example: 'State Machine 3'

  • state_number_inputinteger
    Numeric input value representing a particular animation state.
    Example: 1

  • animation_nametext — NOT NULL
    Name of the animation sequence used in Rive.
    Example: 'idh1'

  • is_deletedboolean — Default: false
    Marks a reward as soft-deleted without removing it from the database.
    Example: false

  • created_attimestamp without time zone — Default: now()
    Timestamp when the reward entry was created.
    Example: '2025-09-10 10:16:04.454505'

  • updated_attimestamp without time zone — Default: now()
    Timestamp when the reward entry was last updated.
    Example: '2025-09-10 10:16:04.454505'

  • state_input_nametext
    The name of the state input in the Rive file, usually matching a numeric control parameter.
    Example: 'Number 2'

  • typepublic.rive_type — NOT NULL, Default: 'normal'::rive_type
    The category or type of reward, referencing a custom PostgreSQL enum (rive_type).
    Example: 'celebrating'

  • max_state_valuebigint — NOT NULL, Default: 8
    The maximum possible state value used in the Rive animation input.
    Example: 31


public.saved_queries

Stores saved SQL queries — used by admins or devs to reuse handy scripts.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid()
    Unique ID for the saved query.
    Example: 'xyz7890a-bc12-34de-fg56-hijk78901234'

  • created_attimestamp without time zone — Default: now()
    When this query was saved.
    Example: '2025-07-02 09:15:00'

  • querytext — NOT NULL. The actual SQL text.
    Example: 'SELECT * FROM public.user WHERE is_deleted = false;'


public.school

Stores information about schools — a key entity for managing students, teachers, and classes.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid()
    Unique school ID.
    Example: 'school-1234-5678-90ab-cdef12345678'

  • nametext — NOT NULL. School name.
    Example: 'St. Mary High School'

  • group1text — The state.
    Example: 'Maharashtra'

  • group2text — The district.
    Example: 'Pune'

  • group3text — The city.
    Example: 'Pimpri'

  • imagetext — URL of the school’s logo or photo.
    Example: 'https://cdn.myapp.com/schools/st_mary_logo.png'

  • created_attimestamp with time zone — NOT NULL, Default: now()
    When this school was added.
    Example: '2025-07-02T10:00:00Z'

  • updated_attimestamp with time zone — Default: now()
    Last update timestamp.
    Example: '2025-07-02T10:30:00Z'

  • is_deletedboolean — Default: false
    Soft delete flag — true means hidden, not removed.
    Example: false

  • firebase_idtext — ID if synced with Firebase.
    Example: 'firebase_school_987654'

  • is_firebaseboolean — Default: false
    true if this record came from Firebase.
    Example: false

  • udisetext — Official UDISE code for the school.
    Example: '27250400123'

  • group4text — The village name, if applicable.
    Example: 'Akurdi'

  • academic_yeartext — The current academic year for this school.
    Example: '2025-2026'

  • languagetext — FK → public.language(id)
    The main language of instruction for the school.
    Example: 'English'

  • student_login_typeUSER-DEFINED — How students log in.
    Example: 'phone_number' or 'email'

  • is_opsboolean — Default: false
    true if created by an operations user.
    Example: true

  • program_iduuid — FK → public.program(id)
    Program this school is linked to.
    Example: '1111-2222-3333-444455556666'

  • modelUSER-DEFINED — Operational model type.
    Example: 'at_home' or 'at_school'

  • addresstext — The full address of the school.
    Example: 'Plot 45, ABC Road, Pimpri, Pune - 411018'

  • ops_created_byuuid — FK → public.user(id)
    User ID of the operations person who created this record.
    Example: 'ops-9999-8888-7777-666655554444'

  • statusUSER-DEFINED — The status of the school whether the school is active, rejected or migrated. Example: 'active','rejected','requested','migrated'

  • key_contactsjsonb — Contact details of the school requested user.
    Example: '[{"name": "Ajax","phone": 9876543210}]'

  • whatsapp_bot_numbertext — Stores a whatsapp bot number for the school.
    Example: '919876543210'


public.school_course

Links which courses are available for a given school.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid()
    Unique link ID.
    Example: 'uuid-1234-5678-90ab-cdef12345678'

  • school_iduuid — NOT NULL. FK → public.school(id)
    The school using this course.
    Example: 'school-uuid-1111-2222-3333-444455556666'

  • course_iduuid — NOT NULL. FK → public.course(id)
    The course offered by this school.
    Example: 'course-uuid-7777-8888-9999-0000aaaabbbb'

  • created_attimestamp with time zone — NOT NULL, Default: now()
    When this link was created.
    Example: '2025-07-02T11:00:00Z'

  • updated_attimestamp with time zone — Default: now()
    Last update.
    Example: '2025-07-02T12:00:00Z'

  • is_deletedboolean — Default: false
    Soft delete flag.
    Example: false

  • is_firebaseboolean — Default: false
    True if synced from Firebase.
    Example: false

  • is_opsboolean — Default: false
    True if created by an operations user.
    Example: true

  • ops_created_byuuid — FK → public.user(id)
    The ops user who added this course link.
    Example: 'ops-user-uuid-9999-8888-7777-6666aaaa5555'


public.school_data

Stores detailed administrative and demographic data for schools, including UDISE linkage.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid()
    Unique ID for this school info record.
    Example: '1234-5678-90ab-cdef12345678'

  • school_nametext
    The official name of the school which is mentioned in school table.
    Example: 'Govt. Primary School, Tibda'

  • districttext
    The district where the school is located.
    Example: 'Moradabad'

  • villagetext
    The village or locality of the school.
    Example: 'Patti'

  • udise_codetext — UNIQUE. The UDISE code that uniquely identifies the school in government data.
    Example: '09120304501'

  • statetext
    The state where the school operates.
    Example: 'Uttar Pradesh'

  • blocktext
    The block or sub-district region.
    Example: 'Bakharwa'

  • clustertext
    Cluster name for administrative grouping.
    Example: 'Garhi Cluster'

  • created_attimestamp with time zone — NOT NULL, Default: now()
    When this record was added.
    Example: '2025-07-02T11:00:00Z'

  • updated_attimestamp without time zone — Default: now()
    When this record was last updated.
    Example: '2025-07-02T12:00:00'

  • instruction_mediumtext
    Medium of instruction(s). May list multiple separated by commas.
    Example: 'ENGLISH, HINDI'

  • total_teachersinteger
    Total number of teachers at this school.
    Example: 12

  • pre_primary_section_availableboolean
    True if the school has a pre-primary section.
    Example: true

  • school_typetext
    Type of school (e.g., 'Government', 'Private', 'Aided').
    Example: 'Government'

  • classestext
    Class levels offered, may be range or comma-separated.
    Example: '1-5' or 'LKG, 1, 2, 3, 4, 5'

  • head_teacherstext
    Name(s) of head teachers, if multiple.
    Example: 'Mr. Ajay Kumar, Mrs. Neha Sharma'

  • head_teachertext
    The main head teacher’s name.
    Example: 'Mr. Ajay Kumar'

  • countrytext — Default: 'India'
    The country.
    Example: 'India'


public.school_user

Links a user to a school with a specific role (like principal, coordinator).

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid()
    Unique ID for this link.
    Example: 'su-uuid-1234-5678-90ab-cdef98765432'

  • school_iduuid — NOT NULL. FK → public.school(id)
    The school the user is attached to.
    Example: 'school-uuid-abc1-2345-6789-defg12345678'

  • user_iduuid — NOT NULL. FK → public.user(id)
    The user assigned to the school.
    Example: 'user-uuid-1111-2222-3333-444455556666'

  • roleUSER-DEFINED — NOT NULL. The user’s role.
    Example: 'principal', 'coordinator', 'sponser', 'field_coordinator'

    principal — Head of the school.

    • Can create classes
    • Can add courses to classes
    • Can edit class-related details

    coordinator — Supports the principal.

    • Has the same access as principal (class creation, course management, and editing)

    sponsor — External supporter (individual or organization).

    • View-only access to school data and reports
    • Cannot create or edit classes/courses

    field_coordinator — Works across multiple schools.

    • Has the same access as principal, but restricted only to the schools they are assigned to
  • created_attimestamp with time zone — NOT NULL, Default: now()
    When this user was linked to the school.
    Example: '2025-07-02T11:30:00Z'

  • updated_attimestamp with time zone — Default: now()
    Last update.
    Example: '2025-07-02T12:30:00Z'

  • is_deletedboolean — Default: false
    Soft delete flag.
    Example: false

  • is_firebaseboolean — Default: false
    True if synced from Firebase.
    Example: false

  • is_opsboolean — Default: false
    True if created by an operations user.
    Example: true

  • ops_created_byuuid — FK → public.user(id)
    The ops user who added this record.
    Example: 'ops-user-uuid-abc1-2345-6789-defg98765432'


public.special_users

Defines system-level special users — e.g., super admins.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid()
    Unique ID for this special user record.
    Example: 'sp-uuid-1234-5678-90ab-cdef54321098'

  • created_attimestamp with time zone — NOT NULL, Default: now()
    When this user got special status.
    Example: '2025-07-02T12:00:00Z'

  • updated_attimestamp with time zone — Default: now()
    Last update.
    Example: '2025-07-02T12:30:00Z'

  • user_iduuid — FK → public.user(id)
    The user who has this special status.
    Example: 'user-uuid-9999-8888-7777-666655554444'

  • is_deletedboolean — Flag for soft deletion.
    Example: false

  • roleUSER-DEFINED — The special role name.
    Example: 'super_admin', 'operational_director'

    super_admin — System-level administrator with full access across all programs, schools, and users.

    operational_director — Senior oversight role with full access across all programs, schools, and users.


public.sticker

Stores collectible stickers for rewards/gamification.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid()
    Unique sticker ID.
    Example: 'st-uuid-1234-5678-90ab-cdefabcdef12'

  • namecharacter varying — NOT NULL. Sticker name.
    Example: 'car'

  • imagetext — URL of the sticker’s image.
    Example: 'https://cdn.myapp.com/stickers/star_performer.png'

  • descriptiontext — Short description or how it’s earned.
    Example: 'Awarded to students who score above 90% in weekly quizzes.'

  • created_attimestamp with time zone — NOT NULL, Default: now()
    When this sticker was created.
    Example: '2025-07-02T12:15:00Z'

  • updated_attimestamp with time zone — Default: now()
    Last update.
    Example: '2025-07-02T12:45:00Z'

  • is_deletedboolean — Default: false
    Soft delete flag.
    Example: false


public.subject

Stores subjects.

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid()
    Unique subject ID.
    Example: 'sub-uuid-1234-5678-90ab-cdefabcd1234'

  • namecharacter varying — NOT NULL. The name of the subject.
    Example: 'Maths', 'Hindi'

  • imagetext — URL of an icon or image for the subject.
    Example: 'https://cdn.myapp.com/subjects/maths_icon.png'

  • descriptiontext — Short description.
    Example: 'Covers numbers, algebra, geometry, and basic calculations.'

  • sort_indexinteger — Used for UI ordering.
    Example: 1

  • created_attimestamp with time zone — NOT NULL, Default: now()
    When this subject was created.
    Example: '2025-07-02T13:00:00Z'

  • updated_attimestamp with time zone — Default: now()
    Last update.
    Example: '2025-07-02T13:30:00Z'

  • is_deletedboolean — Default: false
    Soft delete flag.
    Example: false


public.upload_queue

Manages a queue for asynchronous processing of bulk data uploads in ops — useful for handling large, user batch creation, etc.

  • iduuidPrimary Key, NOT NULL, Default: gen_random_uuid()
    Unique ID for this upload job.
    Example: 'uploadqueue-uuid-1234-5678-90ab-cdef12345678'

  • uploading_useruuidFK → public.user(id)
    The user who initiated the upload request.
    Example: 'user-uuid-1111-2222-3333-444455556666'

  • start_timetimestamp with time zone
    The scheduled time for the system to start processing this upload.
    Example: '2025-07-02T11:30:00Z'

  • payloadjsonbNOT NULL
    The data being uploaded — stored as JSONB for flexible schema. Typically contains a bulk of rows.
    Example: { "students": [ {"name": "Ankit"}, {"name": "Ravi"} ] }

  • statustext — Default: 'pending'
    The current status of this upload job. Common values: 'pending', 'processing', 'completed', 'failed'.
    Example: 'processing'

  • errortext
    Stores any error message if the upload job fails.
    Example: 'File format not supported. Only CSV allowed.'

  • process_started_attimestamp with time zone — Default: now()
    When the system actually started processing this upload.
    Example: '2025-07-02T11:35:00Z'

  • batch_numberbigint
    An optional number to group related uploads (for example, multiple chunks of a huge dataset).
    Example: 20250702

  • is_lockedboolean — Default: false
    True if this job is locked by a worker to prevent parallel processing.
    Example: true

  • locked_attimestamp with time zone
    When this job was locked by a worker for exclusive processing.
    Example: '2025-07-02T11:34:59Z'

  • locked_bytext
    Identifier for the worker or server node that locked this job.
    Example: 'worker-1'


public.user

The central table for storing all user profile information: students, teachers, parents, admins.

  • iduuidPrimary Key, NOT NULL, Default: gen_random_uuid()
    Unique ID for this user.
    Example: 'user-uuid-1234-5678-90ab-cdef12345678'

  • nametext
    Full name of the user.
    Example: 'Ankit Kumar'

  • emailtext
    User’s email address.
    Example: 'ankit.kumar@example.com'

  • phonetext
    User’s phone number.
    Example: '+91-9876543210'

  • gendertext
    Gender of the student.
    Example: 'Male'

  • imagetext
    URL to the profile picture.
    Example: 'https://cdn.schoolapp.com/profiles/user123.jpg'

  • avatartext
    user’s selected avatar.
    Example: 'owl'

  • language_iduuid — FK → public.language(id) Preferred language.
    Example: 'lang-uuid-aaaa-bbbb-cccc-ddddeeeeefff'

  • curriculum_iduuid — FK → public.curriculum(id) Curriculum preference.
    Example: 'curriculum-uuid-1234'

  • created_attimestamp with time zone — NOT NULL, Default: now()
    When the user was created.
    Example: '2025-07-02T12:00:00Z'

  • updated_attimestamp with time zone — Default: now()
    Last updated timestamp.
    Example: '2025-07-02T12:30:00Z'

  • is_deletedboolean — Default: false
    Soft delete flag.
    Example: false

  • is_tc_acceptedboolean — Default: false
    True if user accepted Terms & Conditions.
    Example: true

  • ageinteger
    Age of the student.
    Example: 4

  • grade_iduuid — FK → public.grade(id) Current grade of student.
    Example: 'grade-uuid-9999-8888'

  • music_offboolean — Default: false
    True if user muted background music.
    Example: true

  • sfx_offboolean — Default: false
    True if user muted sound effects.
    Example: false

  • fcm_tokentext
    Firebase token for push notifications.
    Example: 'fcm:abc123xyz'

  • student_idtext
    Unique student ID.
    Example: 'SCH12345'

  • firebase_idtext
    Firebase Auth ID.
    Example: 'firebase-uid-abcdefg'

  • is_firebaseboolean — Default: false
    True if synced from Firebase.
    Example: true

  • is_opsboolean — Default: false
    True if this is an ops/admin account.
    Example: true

  • starsinteger
    Total stars student earned.
    Example: 80

  • learning_pathtext
    ID for assigned learning path.
    Example: '"courses":{"courseList":[{"path_id":"87b1b637-9e2a-465e-b962-8e4b233e75ae","course_id":"63e40488-3c1a-47ab-aa8a-6f07ad21709f","subject_id":"54abf22e-7102-4e14-915b-acd8eab47d56","path":[{"lesson_id":"59cfd524-4a11-4246-a7aa-bbb37f068fd1","chapter_id":"6500f059-c866-446b-a669-ccc1a82225e6"},{"lesson_id":"9e4aa671-074a-4855-a064-640300855a5e",}]}'

  • ops_created_byuuid → [public.user(id)]
    Admin user who created this record.
    Example: 'ops-user-uuid-5555'

  • rewardtext
    JSON object containing reward information (e.g., last received reward and timestamp).
    Example:

     {
      "reward_id": "262cc636-3618-4736-a7f6-dd253b990a5c",
      "timestamp": "2025-10-24T09:49:13.018Z"
     }
    
    

public.user_badge

Tracks which badges a user has earned.

  • user_iduuid — NOT NULL, FK → public.user(id) The user who owns the badge.
    Example: 'user-uuid-1234'

  • badge_iduuid — NOT NULL, FK → public.badge(id) The badge awarded.
    Example: 'badge-uuid-9876'

  • created_attimestamp with time zone — NOT NULL, Default: now()
    When the badge was earned.
    Example: '2025-07-02T13:00:00Z'

  • updated_attimestamp with time zone — Default: now()
    Last updated.
    Example: '2025-07-02T13:05:00Z'

  • is_deletedboolean — Default: false
    Soft delete.
    Example: false

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid()
    Unique row ID.
    Example: 'userbadge-uuid-5555'

  • is_seenboolean
    True if user has seen the badge in app.
    Example: true

  • is_firebaseboolean — Default: false
    Synced from Firebase?
    Example: false


public.user_bonus

Tracks bonus lessons unlocked by the user on every month.

  • user_iduuid — NOT NULL, FK → public.user(id) User receiving the bonus.
    Example: 'user-uuid-1234'

  • bonus_iduuid — NOT NULL, FK → public.lesson(id) Bonus lesson ID.
    Example: 'lesson-uuid-abc123'

  • created_attimestamp with time zone — NOT NULL, Default: now()
    When bonus was granted.
    Example: '2025-07-02T13:10:00Z'

  • updated_attimestamp with time zone — Default: now()
    Last update.
    Example: '2025-07-02T13:15:00Z'

  • is_deletedboolean — Default: false
    Soft delete.
    Example: false

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid()
    Unique ID.
    Example: 'userbonus-uuid-3333'

  • is_seenboolean
    True if user saw this bonus.
    Example: true

  • is_firebaseboolean — Default: false
    Synced from Firebase?
    Example: false


public.user_course

Links users to courses (enrollment).

  • user_iduuid — NOT NULL, FK → public.user(id) student enrolled.
    Example: 'user-uuid-5555'

  • course_iduuid — NOT NULL, FK → public.course(id) Course enrolled for the students.
    Example: 'course-uuid-9999'

  • created_attimestamp with time zone — NOT NULL, Default: now()
    Enrollment date.
    Example: '2025-07-02T14:00:00Z'

  • updated_attimestamp with time zone — Default: now()
    Last update.
    Example: '2025-07-02T14:05:00Z'

  • is_deletedboolean — Default: false
    Soft delete.
    Example: false

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid()
    Unique ID.
    Example: 'usercourse-uuid-8888'

  • is_firebaseboolean — Default: false
    Synced from Firebase?
    Example: false


public.user_sticker

Tracks stickers collected by a user.

  • user_iduuid — NOT NULL, FK → public.user(id) Student who owns the sticker.
    Example: 'user-uuid-5555'

  • sticker_iduuid — NOT NULL, FK → public.sticker(id) Sticker awarded.
    Example: 'sticker-uuid-7777'

  • created_attimestamp with time zone — NOT NULL, Default: now()
    When the sticker was awarded.
    Example: '2025-07-02T15:00:00Z'

  • updated_attimestamp with time zone — Default: now()
    Last update.
    Example: '2025-07-02T15:05:00Z'

  • is_deletedboolean — Default: false
    Soft delete.
    Example: false

  • iduuid — Primary Key, NOT NULL, Default: gen_random_uuid()
    Unique row ID.
    Example: 'usersticker-uuid-1010'

  • is_seenboolean
    True if user has seen the sticker.
    Example: true

  • is_firebaseboolean — Default: false
    Synced from Firebase?
    Example: false

Clone this wiki locally