Schema Reference
WinStudentGoalTracker
15
Tables
4
Core tables
18
Foreign keys
5
Unique keys
1
Self-ref FK
Table Definitions
PK Primary Key
FK Foreign Key
UQ Unique Key
IDX Index
NN NOT NULL
NULL nullable
Core — No dependencies
permission
Defines granular access rights. Each row represents a specific
action on a resource within a scope.
6 columns
| Column | Type | Null | Default | Key | References |
|---|---|---|---|---|---|
| id_permission | int | NN | — | PK | — |
| name | varchar(100) | NULL | — | — | — |
| description | text | NULL | — | — | — |
| resource | varchar(100) | NULL | — | — | — |
| action | varchar(50) | NULL | — | — | — |
| scope | varchar(50) | NULL | — | — | — |
role
User roles that bundle permissions. Referenced by
user
and role_permission.
4 columns
| Column | Type | Null | Default | Key | References |
|---|---|---|---|---|---|
| id_role | int | NN | — | PK | — |
| name | varchar(100) | NULL | — | — | — |
| description | text | NULL | — | — | — |
| created_at | timestamp | NULL | — | — | — |
role_permission
Junction table assigning permissions to roles. Many-to-many
between
role and permission.
3 columns
| Column | Type | Null | Default | Key | References |
|---|---|---|---|---|---|
| id_role_permission | int | NN | — | PK | — |
| id_role | int | NULL | — | FK IDX | role.id_role |
| id_permission | int | NULL | — | FK IDX | permission.id_permission |
school_district
Top-level organizational unit. Programs belong to a district.
4 columns
| Column | Type | Null | Default | Key | References |
|---|---|---|---|---|---|
| id_school_district | int | NN | — | PK | — |
| name | varchar(255) | NULL | — | — | — |
| contact_email | varchar(255) | NULL | — | — | — |
| created_at | timestamp | NULL | — | — | — |
Users — Authentication & security
user
Application user accounts with role assignment and login
security
tracking (failed attempts, lockout).
9 columns
| Column | Type | Null | Default | Key | References |
|---|---|---|---|---|---|
| id_user | int | NN | — | PK | — |
| id_role | int | NULL | — | FK IDX | role.id_role |
| varchar(255) | NULL | — | — | — | |
| name | varchar(255) | NULL | — | — | — |
| password_hash | varchar(255) | NULL | — | — | — |
| password_updated_at | timestamp | NULL | — | — | — |
| failed_login_attempts | int | NULL | 0 | — | — |
| locked_until | timestamp | NULL | — | — | — |
| created_at | timestamp | NULL | — | — | — |
password_history
Stores hashed past passwords per user to enforce password reuse
policies.
4 columns
| Column | Type | Null | Default | Key | References |
|---|---|---|---|---|---|
| id_password_history | int | NN | — | PK | — |
| id_user | int | NULL | — | FK IDX | user.id_user |
| password_hash | varchar(255) | NN | — | — | — |
| created_at | timestamp | NULL | — | — | — |
password_reset_token
Manages password reset flows. Tracks token lifecycle — creation,
expiry, use, and invalidation — plus the requesting IP.
8 columns
| Column | Type | Null | Default | Key | References |
|---|---|---|---|---|---|
| id_password_reset_token | int | NN | — | PK | — |
| id_user | int | NULL | — | FK IDX | user.id_user |
| token_hash | varchar(255) | NULL | — | UQ | — |
| expires_at | timestamp | NN | — | — | — |
| created_at | timestamp | NULL | — | — | — |
| used_at | timestamp | NULL | — | — | — |
| invalidated_at | timestamp | NULL | — | — | — |
| request_ip | varchar(45) | NULL | — | — | — |
Programs — District-level offerings
program
An educational program offered by a school district. Students
and
users are associated to programs.
5 columns
| Column | Type | Null | Default | Key | References |
|---|---|---|---|---|---|
| id_program | int | NN | — | PK | — |
| id_school_district | int | NULL | — | FK IDX | school_district.id_school_district |
| name | varchar(255) | NULL | — | — | — |
| description | text | NULL | — | — | — |
| created_at | timestamp | NULL | — | — | — |
user_program
Junction table assigning users to programs. Supports a
primary-program designation and active/inactive status.
6 columns
| Column | Type | Null | Default | Key | References |
|---|---|---|---|---|---|
| id_user_program | int | NN | — | PK | — |
| id_user | int | NULL | — | FK UQ | user.id_user |
| id_program | int | NULL | — | FK UQ IDX | program.id_program |
| is_primary | tinyint(1) | NULL | 0 | — | — |
| status | varchar(20) | NULL | 'active' | — | — |
| joined_at | timestamp | NULL | — | — | — |
Students — Enrollment & access
student
Core student record. Linked to a program and identified by an
opaque
identifier field (e.g. district ID). Tracks enrollment and expected
graduation dates.
7 columns
| Column | Type | Null | Default | Key | References |
|---|---|---|---|---|---|
| id_student | int | NN | — | PK | — |
| id_program | int | NULL | — | FK IDX | program.id_program |
| identifier | varchar(50) | NULL | — | — | — |
| program_year | int | NULL | — | — | — |
| enrollment_date | date | NULL | — | — | — |
| expected_grad | date | NULL | — | — | — |
| created_at | timestamp | NULL | — | — | — |
user_student
Controls which users have access to which students, with
optional
access level differentiation and a primary-counselor flag.
5 columns
| Column | Type | Null | Default | Key | References |
|---|---|---|---|---|---|
| id_user_student | int | NN | — | PK | — |
| id_user | int | NULL | — | FK IDX | user.id_user |
| id_student | int | NULL | — | FK IDX | student.id_student |
| access_level | varchar(50) | NULL | — | — | — |
| is_primary | tinyint(1) | NULL | — | — | — |
Goals & Notes — Goal tracking
goal
Student goals with hierarchical structure (self-referencing
id_goal_parent FK). Each goal belongs to a student and was created by a
user.
9 columns
| Column | Type | Null | Default | Key | References |
|---|---|---|---|---|---|
| id_goal | int | NN | — | PK | — |
| id_goal_parent | int | NULL | — | FK IDX | goal.id_goal (self) |
| id_student | int | NULL | — | FK IDX | student.id_student |
| id_user_created | int | NULL | — | FK IDX | user.id_user |
| title | varchar(255) | NULL | — | — | — |
| description | text | NULL | — | — | — |
| category | varchar(100) | NULL | — | — | — |
| created_at | timestamp | NULL | — | — | — |
| updated_at | timestamp | NULL | — | — | — |
health_note
Free-text health or welfare notes attached to a student,
authored by
a user. Intended for sensitive, restricted-access information.
5 columns
| Column | Type | Null | Default | Key | References |
|---|---|---|---|---|---|
| id_health_note | int | NN | — | PK | — |
| id_student | int | NULL | — | FK IDX | student.id_student |
| id_user_created | int | NULL | — | FK IDX | user.id_user |
| content | text | NULL | — | — | — |
| created_at | timestamp | NULL | — | — | — |
Progress — Events & reports
progress_event
Individual logged events tied to a student and optionally a
specific
goal. The
is_sensitive flag marks events requiring restricted
visibility.
8 columns
| Column | Type | Null | Default | Key | References |
|---|---|---|---|---|---|
| id_progress_event | int | NN | — | PK | — |
| id_student | int | NULL | — | FK IDX | student.id_student |
| id_goal | int | NULL | — | FK IDX | goal.id_goal |
| id_user_created | int | NULL | — | FK IDX | user.id_user |
| content | text | NULL | — | — | — |
| is_sensitive | tinyint(1) | NULL | — | — | — |
| created_at | timestamp | NULL | — | — | — |
| updated_at | timestamp | NULL | — | — | — |
progress_report
Periodic summary reports for a student's goal. Identified by
period and year for reporting cycles (e.g. quarters,
semesters).
8 columns
| Column | Type | Null | Default | Key | References |
|---|---|---|---|---|---|
| id_progress_report | int | NN | — | PK | — |
| id_student | int | NULL | — | FK IDX | student.id_student |
| id_goal | int | NULL | — | FK IDX | goal.id_goal |
| id_user_created | int | NULL | — | FK IDX | user.id_user |
| period | varchar(10) | NULL | — | — | — |
| year | int | NULL | — | — | — |
| summary | text | NULL | — | — | — |
| generated_at | timestamp | NULL | — | — | — |