Adding a flag for migration blocker flag in sql assessment and switching to new APIs (#1242)

* Adding a flag for migration blocker in sql assessment and switching to new APIs

* Fixing var names
This commit is contained in:
Aasim Khan
2021-09-08 15:15:56 -07:00
committed by GitHub
parent 93728df53d
commit 6f5cac4cb5
5 changed files with 18 additions and 19 deletions

View File

@@ -174,10 +174,10 @@ namespace Microsoft.SqlTools.ServiceLayer.Migration
internal async Task<MigrationAssessmentResult> GetAssessmentItems(string[] connectionStrings)
{
SqlAssessmentConfiguration.EnableLocalLogging = true;
SqlAssessmentConfiguration.EnableReportCreation = true;
SqlAssessmentConfiguration.AssessmentReportAndLogsRootFolderPath = Path.GetDirectoryName(Logger.LogFileFullPath);
DmaEngine engine = new DmaEngine(connectionStrings);
ISqlMigrationAssessmentModel contextualizedAssessmentResult = await engine.GetTargetAssessmentResultsList(System.Threading.CancellationToken.None);
ISqlMigrationAssessmentModel contextualizedAssessmentResult = await engine.GetTargetAssessmentResultsListWithCheck(System.Threading.CancellationToken.None);
engine.SaveAssessmentResultsToJson(contextualizedAssessmentResult, false);
var server = (contextualizedAssessmentResult.Servers.Count > 0)? ParseServerAssessmentInfo(contextualizedAssessmentResult.Servers[0], engine): null;
return new MigrationAssessmentResult()
{
@@ -246,25 +246,25 @@ namespace Microsoft.SqlTools.ServiceLayer.Migration
{
return assessmentResults.Select(r =>
{
var check = engine.GetRuleMetadata(r.FeatureId, r.AppliesToMigrationTargetPlatform);
return new MigrationAssessmentInfo()
{
CheckId = check.Id,
Description = check.Description,
DisplayName = check.DisplayName,
HelpLink = check.HelpLink,
Level = check.Level.ToString(),
TargetName = r.AppliesToMigrationTargetPlatform.ToString(),
CheckId = r.Check.Id,
Description = r.Check.Description,
DisplayName = r.Check.DisplayName,
HelpLink = r.Check.HelpLink,
Level = r.Check.Level.ToString(),
TargetType = r.TargetType.ToString(),
DatabaseName = r.DatabaseName,
ServerName = r.ServerName,
Tags = check.Tags.ToArray(),
Tags = r.Check.Tags.ToArray(),
RulesetName = Engine.Configuration.DefaultRuleset.Name,
RulesetVersion = Engine.Configuration.DefaultRuleset.Version.ToString(),
RuleId = r.FeatureId.ToString(),
Message = r.Message,
AppliesToMigrationTargetPlatform = r.AppliesToMigrationTargetPlatform.ToString(),
IssueCategory = r.IssueCategory.ToString(),
ImpactedObjects = ParseImpactedObjects(r.ImpactedObjects)
ImpactedObjects = ParseImpactedObjects(r.ImpactedObjects),
DatabaseRestoreFails = r.DatabaseRestoreFails
};
}).ToArray();
}