Project: Okul Database · Hub: Okul Database — Reference
Reference: configs Table
The configs table acts as a dynamic enum/lookup store. Many foreign key IDs in other tables resolve here instead of a dedicated lookup table.
Table Schema
CREATE TABLE configs (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
type VARCHAR(255) NOT NULL,
item_id INT NOT NULL,
item_value VARCHAR(255) NOT NULL,
status ENUM('0','1') DEFAULT '1', -- 1=active
logic_status ENUM('0','1') NULLABLE, -- 1=positive outcome, 0=negative
description TEXT NOT NULL,
created_at TIMESTAMP,
updated_at TIMESTAMP,
deleted_at TIMESTAMP NULLABLE
)type Values (All Config Namespaces)
| type | Used In | Reference Note |
|---|---|---|
customer_user_role | customer_users.role_id | See ref-roles-permissions |
customer_user_title | customer_users.title_id | See ref-roles-permissions |
offer_approved_status | leads.approved_status_id | See ref-lead-stages |
school_answered_deal_status | leads.school_answered_deal_status | See ref-interaction-values |
deal_cause_of_reason | leads.deal_cause_of_reason | See ref-interaction-values |
lead_pool_form_status | lead pool form tracking | See ref-lead-stages |
interaction_reason | school_interactions.reason_id | See ref-interaction-values |
interaction_result | school_interactions.result_id | See ref-interaction-values |
interaction_type | school_interactions.type_id | See ref-interaction-values |
school_badge_type | school_badges.type_id | See ref-badges |
source_action_type | leads.source_action context | Added 2026-04-09 |
How to Resolve a config Value
-- Find what role_id=1 means in customer_users
SELECT item_value
FROM configs
WHERE type = 'customer_user_role'
AND item_id = 1
AND deleted_at IS NULL;
-- Returns: "Panel Yöneticisi"
-- Get all values for a type
SELECT item_id, item_value, logic_status
FROM configs
WHERE type = 'interaction_result'
AND deleted_at IS NULL
ORDER BY item_id;logic_status Meaning
| value | meaning |
|---|---|
1 | Positive outcome (success, reached, enrolled) |
0 | Negative outcome (failed, unreachable, rejected) |
NULL | Neutral / not applicable |
This flag is useful for quickly segmenting positive vs negative outcomes without knowing all the specific item_id values:
-- Leads with positive school response
SELECT * FROM leads l
JOIN configs c ON c.type = 'school_answered_deal_status'
AND c.item_id = l.school_answered_deal_status
AND c.logic_status = 1
WHERE l.deleted_at IS NULL;Related
- ref-lead-stages — offer_approved_status, school_answered_deal_status
- ref-interaction-values — All interaction config types
- ref-roles-permissions — customer_user_role, customer_user_title