diff --git a/extensions/sql-migration/src/api/utils.ts b/extensions/sql-migration/src/api/utils.ts index e29d4ff526ae..473f15f3a1c6 100644 --- a/extensions/sql-migration/src/api/utils.ts +++ b/extensions/sql-migration/src/api/utils.ts @@ -782,8 +782,14 @@ export async function createPowershellscriptContentContainer(view: azdata.ModelV }).component(); const scriptpath = path.join(__dirname, '../scripts/SHIR-auto-configuration.ps1'); + const scriptpath2 = path.join(__dirname, '../../scripts/SHIR-auto-configuration.ps1'); - const scriptContent = await fs.readFile(scriptpath); + let scriptContent; + try { + scriptContent = await fs.readFile(scriptpath); + } catch (err) { + scriptContent = await fs.readFile(scriptpath2); + } // inject auth keys in the script const authKeys = await retrieveAuthKeys(migrationStateModel); @@ -792,7 +798,13 @@ export async function createPowershellscriptContentContainer(view: azdata.ModelV // write it back to different file const modifiedScriptPath = path.join(__dirname, '../scripts/SHIR-auto-configuration-with-auth-keys.ps1'); - await fs.writeFile(modifiedScriptPath, modifiedScriptContent); + const modifiedScriptPath2 = path.join(__dirname, '../../scripts/SHIR-auto-configuration.ps1'); + + try { + await fs.writeFile(modifiedScriptPath, modifiedScriptContent); + } catch (err) { + await fs.writeFile(modifiedScriptPath2, modifiedScriptContent); + } saveScriptButton.onDidClick(async () => { const options: vscode.SaveDialogOptions = { diff --git a/extensions/sql-migration/src/dialog/configureIR/configureIRDialog.ts b/extensions/sql-migration/src/dialog/configureIR/configureIRDialog.ts index 860d116a68ce..0728d5d1c848 100644 --- a/extensions/sql-migration/src/dialog/configureIR/configureIRDialog.ts +++ b/extensions/sql-migration/src/dialog/configureIR/configureIRDialog.ts @@ -189,8 +189,14 @@ export class ConfigureIRDialog { // get the SHIR script const scriptPath = path.join(__dirname, '../scripts/SHIR-auto-configuration.ps1'); + const scriptPath2 = path.join(__dirname, '../../../scripts/SHIR-auto-configuration.ps1'); - const scriptContent = await fs.readFile(scriptPath); + let scriptContent; + try { + scriptContent = await fs.readFile(scriptPath); + } catch (err) { + scriptContent = await fs.readFile(scriptPath2); + } // inject auth keys in the script const authKeys = await retrieveAuthKeys(this._migrationStateModel); @@ -199,7 +205,14 @@ export class ConfigureIRDialog { // write it back to different file this.modifiedScriptPath = path.join(__dirname, '../scripts/SHIR-auto-configuration-with-auth-keys.ps1'); - await fs.writeFile(this.modifiedScriptPath, modifiedScriptContent); + const modifiedScriptPath2 = path.join(__dirname, '../../../scripts/SHIR-auto-configuration.ps1'); + + try { + await fs.writeFile(this.modifiedScriptPath, modifiedScriptContent); + } catch (err) { + await fs.writeFile(modifiedScriptPath2, modifiedScriptContent); + this.modifiedScriptPath = modifiedScriptPath2; + } const powershellScriptExpander = view.modelBuilder.button().withProps( { diff --git a/extensions/sql-migration/src/service/features.ts b/extensions/sql-migration/src/service/features.ts index b74bd8e092f4..c1705d120b18 100644 --- a/extensions/sql-migration/src/service/features.ts +++ b/extensions/sql-migration/src/service/features.ts @@ -123,7 +123,7 @@ export class SqlMigrationService extends MigrationExtensionService implements co includePreviewSkus: includePreviewSkus, databaseAllowList: databaseAllowList, isPremiumSSDV2Enabled: true, - isNextGenGPEnabled: includePreviewSkus + isNextGenGPEnabled: true }; try {