-- Aggie's own knowledge base: notes a Tenant Admin keeps for Aggie (how the business works, policies, answers to common questions).
-- Idempotent: safe to re-run.
CREATE TABLE IF NOT EXISTS fact_aggie_knowledge (
    id          BIGINT AUTO_INCREMENT PRIMARY KEY,
    tenant_id   INT NOT NULL,
    title       VARCHAR(200) NOT NULL,
    content     TEXT NOT NULL,
    is_active   TINYINT(1) NOT NULL DEFAULT 1,
    created_at  DATETIME(6) NULL,
    created_by  INT NULL,
    updated_at  DATETIME(6) NULL,
    updated_by  INT NULL,
    is_deleted  TINYINT(1) NOT NULL DEFAULT 0,
    KEY idx_aggie_knowledge_tenant (tenant_id, is_deleted, is_active)
);
