CREATE TABLE calendar_events (
    id INTEGER PRIMARY KEY NOT NULL,
    event_uid TEXT,
    summary TEXT NOT NULL,
    description TEXT,
    location TEXT,
    start_time BIGINT NOT NULL,
    end_time BIGINT NOT NULL,
    all_day BOOLEAN NOT NULL DEFAULT 0,
    organizer TEXT,
    attendees TEXT,
    embedding BLOB,
    created_at BIGINT NOT NULL,
    source_file TEXT,
    UNIQUE(event_uid, start_time)
);

CREATE INDEX idx_calendar_start_time ON calendar_events(start_time);
CREATE INDEX idx_calendar_end_time ON calendar_events(end_time);
CREATE INDEX idx_calendar_time_range ON calendar_events(start_time, end_time);
