ALTER TABLE supplier_media_resources ADD COLUMN IF NOT EXISTS customer_visible BOOLEAN NOT NULL DEFAULT TRUE; CREATE INDEX IF NOT EXISTS idx_supplier_media_resources_customer_visible ON supplier_media_resources (supplier, model_id, customer_visible, updated_at DESC) WHERE deleted_at IS NULL;