# School Year and Semester Schema Audit

Source: `scool_view2.sql`
Tables found: 73

## Result

The schema is not fully fixed.

## Required financial tables

Confirmed with `school_year`:
- payment_notification_logs
- payment_transactions
- reimbursement_batch_items

Absent from this dump and therefore not verifiable:
- discount_usages
- event_charges
- invoice_event
- payment_error

## School-year defects

- `archived_paypal_transactions.school_year` is `VARCHAR(20)` instead of `VARCHAR(9)`.
- Tables with `school_year` but no direct school-year index:
- archived_paypal_transactions
- class_progress_reports
- exams
- missing_score_overrides
- payments
- placement_batches
- print_requests
- report_card_acknowledgements
- semester_scores
- staff_attendance
- teacher_attendance_data
- whatsapp_group_links

## Tables where `semester` should be removed

- badge_print_logs
- classes
- contactus
- emergency_contacts
- inventory_items
- invoice_students_list
- ip_attempts
- notification_recipients
- notifications
- parents
- support_requests
- user_notifications
- whatsapp_group_links

## Tables requiring business-rule confirmation before removing `semester`

- archived_paypal_transactions
- discount_vouchers
- payment_transactions
- reimbursement_batch_items
- scan_log

## Notes

`semester` should remain on semester-owned academic and operational records such as exams, quizzes, grades, class sections, attendance, semester reports, and semester-specific charges or payments.

Child tables should not duplicate `semester` when it can be obtained reliably through their parent record, unless immutable historical snapshots are an explicit requirement.
