move DB init code to common file