Add database middleware and enable it in settings