Skip to main content

CREATE_CONCEPTS_LOG_UPDATE

Constant CREATE_CONCEPTS_LOG_UPDATE 

Source
pub const CREATE_CONCEPTS_LOG_UPDATE: &str = r#"
    CREATE TRIGGER IF NOT EXISTS trg_concepts_log_update
    AFTER UPDATE ON concepts
    BEGIN
        INSERT INTO transaction_log (table_name, entity_id, operation, payload, recorded_at, branch_id)
        VALUES ('concepts', NEW.id, 'U',
                json_object('v', 2, 'title', NEW.title, 'content', NEW.content,
                            'valid_from', NEW.valid_from, 'valid_to', NEW.valid_to,
                            'retired', NEW.retired,
                            'embedding_model', NEW.embedding_model),
                NEW.recorded_at, NEW.branch_id);
    END;
"#;
Expand description

The update half of the concepts log. See CREATE_CONCEPTS_LOG_INSERT.

Unconditional where its insert sibling is marker-gated, and the asymmetry is deliberate: nothing inside an archive session updates a concept, so gating this would suppress nothing.

branch_id is in the column list since v12 and the omission would have been expensive. concepts permits a same-lineage update — the guards refuse cross-lineage inserts and branch_id changes, not this — so a branch correcting a concept it minted would have logged the change against 'main', putting a branch’s own history in the trunk’s fold and leaving the row invisible to the abandonment sweep that §15.5’s archive arm performs.