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)

typeUsed InReference Note
customer_user_rolecustomer_users.role_idSee ref-roles-permissions
customer_user_titlecustomer_users.title_idSee ref-roles-permissions
offer_approved_statusleads.approved_status_idSee ref-lead-stages
school_answered_deal_statusleads.school_answered_deal_statusSee ref-interaction-values
deal_cause_of_reasonleads.deal_cause_of_reasonSee ref-interaction-values
lead_pool_form_statuslead pool form trackingSee ref-lead-stages
interaction_reasonschool_interactions.reason_idSee ref-interaction-values
interaction_resultschool_interactions.result_idSee ref-interaction-values
interaction_typeschool_interactions.type_idSee ref-interaction-values
school_badge_typeschool_badges.type_idSee ref-badges
source_action_typeleads.source_action contextAdded 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

valuemeaning
1Positive outcome (success, reached, enrolled)
0Negative outcome (failed, unreachable, rejected)
NULLNeutral / 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;