BAB 25. ENTITY RELATIONSHIP DIAGRAM (ERD)
Pendahuluan
ERD menggambarkan struktur data dan relasi antar entitas dalam database TemuBelajar yang dirancang dengan prinsip tenant-ready, 3NF, dan Laravel Eloquent Friendly.
ERD Konseptual
erDiagram
SCHOOLS ||--o{ CLASSROOMS : "has"
SCHOOLS ||--o{ USERS : "has"
SCHOOLS ||--o{ SUBJECTS : "has"
CLASSROOMS ||--o{ STUDENTS : "contains"
USERS ||--o| STUDENTS : "is a"
USERS ||--o| TEACHERS : "is a"
STUDENTS ||--o{ STUDENT_SKILLS : "has"
SKILLS ||--o{ STUDENT_SKILLS : "categorized in"
SUBJECTS ||--o{ TOPICS : "has"
STUDENTS ||--o{ REQUESTS : "creates"
SUBJECTS ||--o{ REQUESTS : "referenced in"
TOPICS ||--o{ REQUESTS : "referenced in"
REQUESTS ||--o{ BOOKINGS : "generates"
BOOKINGS ||--|| MEETINGS : "scheduled as"
MEETINGS ||--o{ MEETING_PARTICIPANTS : "has"
MEETINGS ||--o{ RATINGS : "receives"
MEETINGS ||--o{ MEETING_DOCUMENTS : "has"
STUDENTS ||--o{ SOCIAL_IMPACT_SCORES : "accumulates"
STUDENTS ||--o{ ACHIEVEMENTS : "earns"
STUDENTS ||--o{ NOTIFICATIONS : "receives"
Entitas Inti
| Entitas | Fungsi | Relasi Utama |
|---|---|---|
schools | Tenant sekolah (multi-tenant) | Semua entitas |
users | Autentikasi semua pengguna | students, teachers |
students | Data akademik siswa | requests, skills |
teachers | Data guru | meetings (monitoring) |
classrooms | Rombel/kelas | students |
subjects | Master mata pelajaran | requests, topics |
topics | Master materi per mapel | requests |
skills | Master kompetensi | student_skills |
student_skills | Pivot siswa ↔ skill | students, skills |
requests | Permintaan bantuan | bookings |
bookings | Penjadwalan tutor | meetings |
meetings | Sesi pertemuan valid | ratings, documents |
meeting_participants | Peserta sesi | meetings, students |
ratings | Penilaian sesi | meetings, users |
social_impact_scores | Akumulasi SIS | students |
achievements | Badge dan pencapaian | students |
notifications | Riwayat notifikasi | users |
ERD Detail — Core Tables
erDiagram
USERS {
bigint id PK
bigint school_id FK
string name
string username
string password
enum role
boolean must_change_password
timestamp created_at
}
STUDENTS {
bigint id PK
bigint user_id FK
bigint classroom_id FK
string nisn
int level
int xp
decimal sis_score
}
REQUESTS {
bigint id PK
bigint student_id FK
bigint subject_id FK
bigint topic_id FK
string description
string preferred_location
decimal lat
decimal lng
datetime preferred_time
int duration_minutes
int tutor_count
enum status
}
BOOKINGS {
bigint id PK
bigint request_id FK
bigint tutor_id FK
enum status
datetime scheduled_at
decimal matching_score
}
MEETINGS {
bigint id PK
bigint booking_id FK
string qr_token
datetime check_in_at
datetime check_out_at
int duration_actual
text summary
enum completion_status
}
RATINGS {
bigint id PK
bigint meeting_id FK
bigint rater_id FK
bigint ratee_id FK
tinyint score
text comment
boolean is_solved
}
USERS ||--o| STUDENTS : "is"
STUDENTS ||--o{ REQUESTS : "creates"
REQUESTS ||--o{ BOOKINGS : "generates"
BOOKINGS ||--|| MEETINGS : "becomes"
MEETINGS ||--o{ RATINGS : "receives"