Fix database bugs

missing constraints (caused duplicate serverEntryProtocol rows to be inserted); need explicit delete of serverEntryProtocol rows to ensure correct state after an updated server entry is received (in particular, when old capabilities have been removed).