-- Add a nullable thumbnail_filename column to ticket_attachments so an image -- upload can store a separately-generated, resized preview alongside the -- full-size original. NULL means no thumbnail exists (non-image, GD -- unavailable at upload time, or an attachment uploaded before this existed) -- and callers fall back to the full-size original. -- -- scripts/cleanup_orphan_uploads.php's orphan lookup is updated in the same -- change to also match thumbnail_filename, so generated thumbnails aren't -- swept up as orphans. -- -- Safe to re-run. ALTER TABLE `ticket_attachments` ADD COLUMN IF NOT EXISTS `thumbnail_filename` varchar(255) DEFAULT NULL AFTER `filename`;