mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
Fix/restore db files (#491)
* fixed an issue with target database name should replcae the original db name in the db file path
This commit is contained in:
@@ -795,10 +795,10 @@ namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery.RestoreOperation
|
||||
private string GetTargetDbFilePhysicalName(string sourceDbFilePhysicalLocation)
|
||||
{
|
||||
string fileName = Path.GetFileName(sourceDbFilePhysicalLocation);
|
||||
if (!string.IsNullOrEmpty(this.DefaultSourceDbName) && !string.IsNullOrEmpty(this.targetDbName))
|
||||
if (!string.IsNullOrEmpty(this.SourceDatabaseName) && !string.IsNullOrEmpty(this.targetDbName))
|
||||
{
|
||||
string sourceFilename = fileName;
|
||||
fileName = sourceFilename.Replace(this.DefaultSourceDbName, this.targetDbName);
|
||||
fileName = sourceFilename.Replace(this.SourceDatabaseName, this.targetDbName);
|
||||
}
|
||||
return fileName;
|
||||
}
|
||||
@@ -962,9 +962,11 @@ namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery.RestoreOperation
|
||||
|
||||
public bool ShouldCreateNewPlan()
|
||||
{
|
||||
return RestorePlan == null || 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(TargetDatabaseName, this.RestoreParams.GetOptionValue<string>(RestoreOptionsHelper.TargetDatabaseName), StringComparison.InvariantCultureIgnoreCase) != 0 ||
|
||||
string.Compare(this.backupMediaList, RestoreParams.BackupFilePaths, StringComparison.InvariantCultureIgnoreCase) != 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user