Generalized the migration check for query
Fixed badges