Proje: Okul Database · Hub: Okul Database — Tables
schools Tablosu
Tüm platformun temel varlığı. Hemen her şeyin FK hub’ı.
Tam Kolon Listesi
Kolon Tip Nullable Default Açıklama idincrements (uint) NO — PK namevarchar(255) NO ''Okul adı abouttext YES NULL Hakkında yazısı missiontext YES NULL Misyon metni visiontext YES NULL Vizyon metni historytext YES NULL Tarihçe meta_titlevarchar(255) YES NULL SEO başlığı descriptiontext YES NULL Meta description psychological_adviceenum(‘1’,‘0’) NO '0'Psikolojik danışmanlık var mı total_studentsunsignedMediumInt YES NULL Toplam öğrenci class_studentsunsignedSmallInt YES NULL Sınıf başı öğrenci school_type_idunsignedInt YES NULL → schools_types.id sector_idunsignedInt YES NULL → sectors.id (1=Devlet, 2=Özel) college_idunsignedInt YES NULL → colleges.id customer_idint YES NULL → customers.id (NULL = müşteri değil) campus_idint YES NULL → campuses.id (varsayılan kampüs) statusenum(‘1’,‘0’) NO '1'1=Aktif, 0=Pasif reference_codevarchar(255) YES NULL Referans kodu school_closedboolean YES NULL Okul kapandı mı school_closed_idvarchar(50) YES NULL Kapanma nedeni kodu redirect_idunsignedInt YES NULL → schools.id (yönlendirme) created_byunsignedInt YES NULL → users.id monthly_lead_limitsmallInt YES NULL Aylık maks lead sayısı hidden_lead_phoneboolean NO falseLead formunda telefon gizle hidden_lead_formboolean NO falseLead formu gizle created_attimestamp NO CURRENT_TIMESTAMP updated_attimestamp YES NULL deleted_attimestamp YES NULL Soft delete
Foreign Keys
Kolon Referans Tablo Referans Kolon school_type_idschools_typesidsector_idsectorsidcollege_idcollegesidcustomer_idcustomersidcampus_idcampusesidredirect_idschoolsid (self-reference)created_byusersid
Indexes
Index Adı Tip Kolonlar PRIMARY PK idschools_deleted_at_indexINDEX deleted_atschools_sector_id_foreignINDEX sector_idschools_school_type_id_foreignINDEX school_type_idschools_college_id_foreignINDEX college_idschools_customer_id_foreignINDEX customer_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