feat(PROJ-44): ocr_chars-Spalte + SetOCRResult-Helper
DB-Schema bekommt eine idempotente ocr_chars BIGINT-Spalte (Default 0). SetOCRResult schreibt status und chars atomar; GetOCRMeta liest beide mit COALESCE-Defaults. Der OCR-Worker ersetzt jeden SetOCRStatus-Call durch SetOCRResult und uebergibt die extrahierte Zeichenzahl bei 'done'.
This commit is contained in:
@@ -317,6 +317,15 @@ func (s *Store) initSchema(ctx context.Context) error {
|
||||
ALTER TABLE emails ADD COLUMN IF NOT EXISTS ocr_status TEXT DEFAULT 'pending';
|
||||
CREATE INDEX IF NOT EXISTS idx_emails_ocr_status ON emails (ocr_status) WHERE ocr_status = 'pending';
|
||||
`)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// PROJ-44: gecachte Anzahl der extrahierten OCR-Zeichen — vermeidet einen
|
||||
// Manticore-Roundtrip auf der Mail-Detail-Seite. Idempotent wie ocr_status.
|
||||
_, err = s.db.Exec(ctx, `
|
||||
ALTER TABLE emails ADD COLUMN IF NOT EXISTS ocr_chars BIGINT DEFAULT 0;
|
||||
`)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user