refac:moved sql from index service to db facade