## Verwijder alle compannies + users die iets te maken hebben met One-Dyas (3) of een user-package van One-Dyas (41) hebben
delete c
from companies c
         inner join package_subscriptions ps ON (ps.companies_id = c.id)
         inner join users u ON (u.company_id = c.id)
where ps.packages_id = 41
  and u.is_active = 1;

## controleer query resterende companies + users
select c.id, c.name as companyname, c.locales, c.address as company_address, c.subdomain, u.id as user_id, u.email, u.firstname, u.lastname, u.dateofbirth, u.phoneno, u.mobile, u.vantageno, u.function, u.language, u.country
from companies c
         inner join users u ON (u.company_id = c.id)
where u.is_active = 1
order by c.id, u.name;

## opschonen acl_sources
delete from acl_sources where id in (2,5,8,10,13,16);
update acl_sources a set a.url = REPLACE(a.url, '.hselifeunio.com', '.hsedirect.com') where a.source = 'lars';

##opschonen packages
delete from packages where id in (41);

##delete regions
delete from region where id not in (4,33,36);

## delete non One-Dyas or HSELifenl.com trainings
delete from trainings t where url not like '%.hseqdirect.com%';

## verwijder overbodige images uit