Move 'ensureIndexes' into Queue.