Fixes issue where batch insertion on existing db would delete indexes

When doing batch insertion on an existing database containing indexes,
those indexes, or rather the configuration for them (as well as the
existence of them from the dbs POV) would be deleted if not used in this
second batch insertion. I.e. any index configuration would be overwritten
with whatever this second batch insertion did.

Fixes #527