Updated base migration class to handle queries