Implements #690 for the historical database. The queue value of the wrapper section in the config is now stored in the databas if applicable.