Proje: Okul Database · Hub: Okul Database — Tables

schools Tablosu

Tüm platformun temel varlığı. Hemen her şeyin FK hub’ı.


Tam Kolon Listesi

KolonTipNullableDefaultAçıklama
idincrements (uint)NOPK
namevarchar(255)NO''Okul adı
abouttextYESNULLHakkında yazısı
missiontextYESNULLMisyon metni
visiontextYESNULLVizyon metni
historytextYESNULLTarihçe
meta_titlevarchar(255)YESNULLSEO başlığı
descriptiontextYESNULLMeta description
psychological_adviceenum(‘1’,‘0’)NO'0'Psikolojik danışmanlık var mı
total_studentsunsignedMediumIntYESNULLToplam öğrenci
class_studentsunsignedSmallIntYESNULLSınıf başı öğrenci
school_type_idunsignedIntYESNULLschools_types.id
sector_idunsignedIntYESNULLsectors.id (1=Devlet, 2=Özel)
college_idunsignedIntYESNULLcolleges.id
customer_idintYESNULLcustomers.id (NULL = müşteri değil)
campus_idintYESNULLcampuses.id (varsayılan kampüs)
statusenum(‘1’,‘0’)NO'1'1=Aktif, 0=Pasif
reference_codevarchar(255)YESNULLReferans kodu
school_closedbooleanYESNULLOkul kapandı mı
school_closed_idvarchar(50)YESNULLKapanma nedeni kodu
redirect_idunsignedIntYESNULLschools.id (yönlendirme)
created_byunsignedIntYESNULLusers.id
monthly_lead_limitsmallIntYESNULLAylık maks lead sayısı
hidden_lead_phonebooleanNOfalseLead formunda telefon gizle
hidden_lead_formbooleanNOfalseLead formu gizle
created_attimestampNOCURRENT_TIMESTAMP
updated_attimestampYESNULL
deleted_attimestampYESNULLSoft delete

Foreign Keys

KolonReferans TabloReferans Kolon
school_type_idschools_typesid
sector_idsectorsid
college_idcollegesid
customer_idcustomersid
campus_idcampusesid
redirect_idschoolsid (self-reference)
created_byusersid

Indexes

Index AdıTipKolonlar
PRIMARYPKid
schools_deleted_at_indexINDEXdeleted_at
schools_sector_id_foreignINDEXsector_id
schools_school_type_id_foreignINDEXschool_type_id
schools_college_id_foreignINDEXcollege_id
schools_customer_id_foreignINDEXcustomer_id

Önemli İş Kuralları

  • customer_id IS NULL → Okul platformda yer alıyor ama ücretli müşteri değil
  • customer_id NOT NULL → B2B sözleşmesi olan aktif müşteri okul
  • school_closed = 1 → Kapanmış okul, soft delete yapılmamış (tarihsel veri)
  • redirect_id NOT NULL → Bu okul başka okule yönlendiriliyor (kapanan/birleşen okullar)
  • monthly_lead_limit → Ürüne göre aylık maksimum lead; NULL = limitsiz veya ürün yok
  • hidden_lead_form = 1 → Profil sayfasında form gösterilmiyor

Analiz İçin Kritik Filtreler

-- Aktif, silinmemiş okullar
WHERE deleted_at IS NULL AND status = '1' AND school_closed IS NULL
 
-- Ücretli müşteri okullar
WHERE customer_id IS NOT NULL AND deleted_at IS NULL
 
-- Sektör + tip kombinasyonu
WHERE sector_id = 2 AND school_type_id IN (1,2,3,4)  -- Özel: Anaokulu/İlk/Orta/Lise