Fix database conversion.

The new dependencies table was not correctly generated
from older databases, which is fixed in this patch.