-- Migration 004: Add raw_payload_id to discussions
-- The column was expected by code but missing from initial schema

ALTER TABLE discussions ADD COLUMN raw_payload_id INTEGER REFERENCES raw_payloads(id);

-- Update schema version
INSERT INTO schema_version (version, applied_at, description)
VALUES (4, strftime('%s', 'now') * 1000, 'Add raw_payload_id to discussions');
