-- Migration: Create video_interviews table -- Description: Table for scheduling and managing video interviews between companies and candidates CREATE TABLE IF NOT EXISTS video_interviews ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), application_id UUID NOT NULL REFERENCES applications(id) ON DELETE CASCADE, -- Interview scheduling scheduled_at TIMESTAMP WITH TIME ZONE NOT NULL, duration_minutes INTEGER NOT NULL DEFAULT 30, timezone VARCHAR(50) NOT NULL DEFAULT 'UTC', -- Interview details meeting_link VARCHAR(500), meeting_provider VARCHAR(50) DEFAULT 'custom', -- custom, zoom, meet, teams meeting_id VARCHAR(255), meeting_password VARCHAR(100), -- Status status VARCHAR(30) NOT NULL DEFAULT 'scheduled', -- scheduled, in_progress, completed, cancelled, no_show started_at TIMESTAMP WITH TIME ZONE, ended_at TIMESTAMP WITH TIME ZONE, -- Notes and feedback notes TEXT, interviewer_feedback TEXT, candidate_feedback TEXT, rating INTEGER, -- 1-5 rating -- Metadata created_by UUID REFERENCES users(id), created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); -- Indexes CREATE INDEX IF NOT EXISTS idx_video_interviews_application_id ON video_interviews(application_id); CREATE INDEX IF NOT EXISTS idx_video_interviews_scheduled_at ON video_interviews(scheduled_at); CREATE INDEX IF NOT EXISTS idx_video_interviews_status ON video_interviews(status); -- Comments COMMENT ON TABLE video_interviews IS 'Video interview scheduling for job applications'; COMMENT ON COLUMN video_interviews.application_id IS 'The job application this interview is for'; COMMENT ON COLUMN video_interviews.scheduled_at IS 'When the interview is scheduled to start'; COMMENT ON COLUMN video_interviews.duration_minutes IS 'Interview duration in minutes'; COMMENT ON COLUMN video_interviews.meeting_link IS 'URL to join the video meeting'; COMMENT ON COLUMN video_interviews.meeting_provider IS 'Video meeting provider: custom, zoom, google_meet, teams'; COMMENT ON COLUMN video_interviews.status IS 'Interview status: scheduled, in_progress, completed, cancelled, no_show';