-- Migration 026: Add public_token to technical_materials for clean share URLs
ALTER TABLE technical_materials ADD COLUMN public_token VARCHAR(36) NULL UNIQUE AFTER status;
CREATE INDEX idx_materials_public_token ON technical_materials(public_token);

-- Backfill tokens for existing materials
UPDATE technical_materials SET public_token = LOWER(REPLACE(UUID(), '-', '')) WHERE public_token IS NULL;
