-- Case material links must be deployment-relative.  A persisted localhost URL
-- makes a student's browser download from its own computer instead of this server.
UPDATE training_task
SET material_url = REGEXP_REPLACE(material_url, '^https?://(localhost|127\\.0\\.0\\.1)(:[0-9]+)?', '')
WHERE material_url REGEXP '^https?://(localhost|127\\.0\\.0\\.1)(:[0-9]+)?/file/';

UPDATE training_task_class_config
SET material_url = REGEXP_REPLACE(material_url, '^https?://(localhost|127\\.0\\.0\\.1)(:[0-9]+)?', '')
WHERE material_url REGEXP '^https?://(localhost|127\\.0\\.0\\.1)(:[0-9]+)?/file/';
