-- disable the triggers
ALTER TABLE projectpids DISABLE TRIGGER ALL;
ALTER TABLE project_subject DISABLE TRIGGER ALL;
ALTER TABLE fundingpaths DISABLE TRIGGER ALL;
ALTER TABLE project_fundingpath DISABLE TRIGGER ALL;
ALTER TABLE project_organization DISABLE TRIGGER ALL;
ALTER TABLE dsm_organizations DISABLE TRIGGER ALL;
ALTER TABLE projects DISABLE TRIGGER ALL;

-- then for each funder, changing the PREFIX
DELETE FROM projectpids where project like 'PREFIX%';
DELETE FROM project_subject where project like 'PREFIX%';
DELETE FROM subjects where id like 'PREFIX%';
DELETE FROM project_fundingpath where project like 'PREFIX%';
DELETE FROM fundingpaths where id like 'PREFIX%';
DELETE FROM project_organization where project like 'PREFIX%';
DELETE FROM dsm_organizations where id like 'PREFIX%';
DELETE FROM projects where id like 'PREFIX%';

-- enable the triggers
ALTER TABLE projectpids ENABLE TRIGGER ALL;
ALTER TABLE project_subject ENABLE TRIGGER ALL;
ALTER TABLE subjects ENABLE TRIGGER ALL;
ALTER TABLE fundingpaths ENABLE TRIGGER ALL;
ALTER TABLE project_fundingpath ENABLE TRIGGER ALL;
ALTER TABLE project_organization ENABLE TRIGGER ALL;
ALTER TABLE dsm_organizations ENABLE TRIGGER ALL;
ALTER TABLE projects ENABLE TRIGGER ALL;