Proje: Okul Database · Hub: Okul Database — Tables
school_interactions Tablosu
CRM aktivite logu. Her müşteri-okul teması kaydedilir.
Kolonlar
| Kolon | Tip | Açıklama |
|---|---|---|
id | bigint PK | |
school_id | FK | → schools |
campus_id | FK nullable | → campuses |
customer_id | FK | → customers |
customer_user_id | FK | → customer_users |
type | varchar | İnteraksiyon tipi (call, email, meeting…) |
is_latest | tinyint | Bu okul için son interaction mı |
note | text nullable | İnteraksiyon notu |
interacted_at | timestamp | İnteraksiyon zamanı |
created_at | timestamp | |
deleted_at | timestamp | Soft delete |
Index Stratejisi
8 compound index var — temporal ve kategorik sorgular için optimize edilmiş:
(is_latest, deleted_at, school_id, created_at)
(school_id, campus_id, customer_id, is_latest)
... vb.
is_latest Kullanımı
-- Her okulun son interaction'ı
SELECT * FROM school_interactions
WHERE is_latest = 1 AND deleted_at IS NULL;
-- Belirli bir okul için tüm interaction geçmişi
SELECT * FROM school_interactions
WHERE school_id = ? AND deleted_at IS NULL
ORDER BY interacted_at DESC;Related
- table-schools — Okul bağlantısı
- domain-schools — Schools domain
- domain-leads-sales — CRM bağlamı