mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-22 17:24:07 -05:00
fixed couple of issues in restore (#470)
This commit is contained in:
@@ -86,6 +86,10 @@ namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery.RestoreOperation
|
||||
RestoreAsFileName = x.PhysicalNameRelocate
|
||||
});
|
||||
response.CanRestore = CanRestore(restoreDataObject);
|
||||
if (!response.CanRestore)
|
||||
{
|
||||
response.ErrorMessage = SR.NoBackupsetsToRestore;
|
||||
}
|
||||
|
||||
response.PlanDetails.Add(LastBackupTaken,
|
||||
RestorePlanDetailInfo.Create(name: LastBackupTaken, currentValue: restoreDataObject.GetLastBackupTaken(), isReadOnly: true));
|
||||
|
||||
@@ -921,8 +921,9 @@ namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery.RestoreOperation
|
||||
|
||||
public bool ShouldCreateNewPlan()
|
||||
{
|
||||
return string.Compare(RestorePlanner.DatabaseName, this.RestoreParams.GetOptionValue<string>(RestoreOptionsHelper.SourceDatabaseName), StringComparison.InvariantCultureIgnoreCase) != 0 ||
|
||||
return RestorePlan == null || string.Compare(RestorePlanner.DatabaseName, this.RestoreParams.GetOptionValue<string>(RestoreOptionsHelper.SourceDatabaseName), StringComparison.InvariantCultureIgnoreCase) != 0 ||
|
||||
RestorePlanner.ReadHeaderFromMedia != this.RestoreParams.ReadHeaderFromMedia ||
|
||||
this.RelocateAllFiles != this.RestoreParams.GetOptionValue<bool>(RestoreOptionsHelper.RelocateDbFiles) ||
|
||||
string.Compare(this.backupMediaList, RestoreParams.BackupFilePaths, StringComparison.InvariantCultureIgnoreCase) != 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -507,8 +507,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery.RestoreOperation
|
||||
{
|
||||
string errorMessage = string.Empty;
|
||||
var sourceDbNames = restoreDataObject.SourceDbNames;
|
||||
if (currentValue == null || (sourceDbNames != null &&
|
||||
!sourceDbNames.Any(x => string.Compare(x, currentValue.ToString(), StringComparison.InvariantCultureIgnoreCase) == 0)))
|
||||
if (currentValue == null)
|
||||
{
|
||||
errorMessage = "Source database name is not valid";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user