chore: delete relate rows when deleting the factory