ALTER TABLE attachments ADD COLUMN IF NOT EXISTS drive_path TEXT NOT NULL DEFAULT ''; CREATE INDEX IF NOT EXISTS idx_attachments_drive_path ON attachments (drive_path) WHERE drive_path <> '';