rapid7/metasploit_data_models — pull request #16 by sempervictus (2013-05-01 05:26:10+00:00)
Title: Rewire the migration to ignore orphan DB objects

Legacy databases can contain orphan creds and services.
AddCredsCounterCache iterates through all creds, finding their
associated services, and the host associated with that service.
host.creds.count is then called to set the counter cache. Orphan
objects in the DB can cause the chain to call :host on a nil
service or :creds on a nil host.

This artifact showed up in an older install of framework which
was behind on updates. Not a common event, but should be handled
without forcing the user to delete what may be useful information.