fixes #6126 - deleting a subnet that is associated with a host group throws foreign key error

this is going to be painful if there a lot of trendcounters, ideally should add a todo here do delete in bg when possible.