Clean up all templates
Run this query to remove all templates from the database. This will also remove all files associated with the templates.
SET
FOREIGN_KEY_CHECKS = 0;
DELETE
FROM file_download
WHERE file_id IN (SELECT file_id FROM template_template_file);
DELETE
FROM file_file_object
WHERE file_id IN (SELECT file_id FROM template_template_file);
DELETE
FROM file_file
WHERE id IN (SELECT file_id FROM template_template_file);
DELETE
FROM file_download
WHERE file_id IN (SELECT file_id FROM template_step_file);
DELETE
FROM file_file_object
WHERE file_id IN (SELECT file_id FROM template_step_file);
DELETE
FROM file_file
WHERE id IN (SELECT file_id FROM template_step_file);
TRUNCATE TABLE template_changelog;
TRUNCATE TABLE template_measurement;
TRUNCATE TABLE template_measurement_label;
TRUNCATE TABLE template_measurement_logging_parameter;
TRUNCATE TABLE template_release;
TRUNCATE TABLE template_requirement;
TRUNCATE TABLE template_requirement_label;
TRUNCATE TABLE template_requirement_target;
TRUNCATE TABLE template_step;
TRUNCATE TABLE template_step_file;
TRUNCATE TABLE template_step_group;
TRUNCATE TABLE template_step_label;
TRUNCATE TABLE template_step_parameter;
TRUNCATE TABLE template_step_parameter_value;
TRUNCATE TABLE template_step_tag;
TRUNCATE TABLE template_template;
TRUNCATE TABLE template_template_file;
TRUNCATE TABLE template_template_role;
TRUNCATE TABLE template_template_variable;
SET
FOREIGN_KEY_CHECKS = 1;
07 April 2025