fix: trend_windows now upserts instead of accumulating (7.5GB→4MB), add competitive signal retention cleanup
This commit is contained in:
@@ -716,6 +716,18 @@ INSERT INTO trend_windows (
|
||||
$9::jsonb, $10::jsonb, $11,
|
||||
$12::jsonb, $13::jsonb, $14
|
||||
)
|
||||
ON CONFLICT (entity_type, entity_id, "window") DO UPDATE SET
|
||||
trend_direction = EXCLUDED.trend_direction,
|
||||
trend_strength = EXCLUDED.trend_strength,
|
||||
confidence = EXCLUDED.confidence,
|
||||
top_supporting_evidence = EXCLUDED.top_supporting_evidence,
|
||||
top_opposing_evidence = EXCLUDED.top_opposing_evidence,
|
||||
dominant_catalysts = EXCLUDED.dominant_catalysts,
|
||||
material_risks = EXCLUDED.material_risks,
|
||||
contradiction_score = EXCLUDED.contradiction_score,
|
||||
disagreement_details = EXCLUDED.disagreement_details,
|
||||
market_context = EXCLUDED.market_context,
|
||||
generated_at = EXCLUDED.generated_at
|
||||
RETURNING id
|
||||
"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user