Add calendar_event_participants table and dedup index for PST re-imports

This commit is contained in:
iamdoubz
2026-07-01 15:08:07 -05:00
parent 8ac92aae2f
commit b2425fa5e6
@@ -0,0 +1,19 @@
-- WhispAssist calendar-event attendees schema (Phase 6, T6.1/T6.2, FR-CAL-1).
-- Forward-only migration. Mirrors docs/03-data-model.md.
PRAGMA foreign_keys = ON;
-- Attendees per imported calendar event (populated at import time from the
-- source's own attendee list, e.g. a .pst appointment's ATTENDEE lines) —
-- distinct from meeting_participants, which links a *recording* to people
-- once a meeting is attached to an event (T6.3/T6.6).
CREATE TABLE calendar_event_participants (
calendar_event_id TEXT NOT NULL REFERENCES calendar_events(id) ON DELETE CASCADE,
participant_id TEXT NOT NULL REFERENCES participants(id),
role TEXT, -- organizer|required|optional
PRIMARY KEY (calendar_event_id, participant_id)
);
-- Dedup re-imports of the same PST (or the same event across multiple PSTs
-- from the same source kind) by the source's own stable UID.
CREATE UNIQUE INDEX idx_calendar_events_source_uid ON calendar_events(source, raw_uid)
WHERE raw_uid IS NOT NULL;