-- 036_candidate_source_links.sql -- Scored `candidates` rows point at the application that owns the CV text. -- Extract lives on inbox_messages.resume_text / manual_upload_candidate.full_text -- (so Inbox and CV Bank can fetch it). Do not duplicate that blob here. -- Drops resume_text if an earlier draft of this file added it. -- Applied at startup by alembic_setup.run_manual_sql(). ALTER TABLE app.candidates DROP COLUMN IF EXISTS resume_text; ALTER TABLE app.candidates ADD COLUMN IF NOT EXISTS inbox_message_id UUID REFERENCES app.inbox_messages (id); ALTER TABLE app.candidates ADD COLUMN IF NOT EXISTS manual_upload_candidate_id UUID REFERENCES app.manual_upload_candidate (id); CREATE INDEX IF NOT EXISTS ix_candidates_inbox_message_id ON app.candidates (inbox_message_id); CREATE INDEX IF NOT EXISTS ix_candidates_manual_upload_candidate_id ON app.candidates (manual_upload_candidate_id);