mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 09:35:39 -05:00
copying dacpac to temp folder before deploying (#11036)
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
import * as constants from '../common/constants';
|
||||
import * as dataSources from '../models/dataSources/dataSources';
|
||||
import * as mssql from '../../../mssql';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import * as utils from '../common/utils';
|
||||
import * as UUID from 'vscode-languageclient/lib/utils/uuid';
|
||||
@@ -222,13 +223,17 @@ export class ProjectsController {
|
||||
return undefined; // buildProject() handles displaying the error
|
||||
}
|
||||
|
||||
const dacFxService = await ProjectsController.getDaxFxService();
|
||||
// copy dacpac to temp location before deployment
|
||||
const tempPath = path.join(os.tmpdir(), `${path.parse(dacpacPath).name}_${new Date().getTime()}${constants.sqlprojExtension}`);
|
||||
await fs.copyFile(dacpacPath, tempPath);
|
||||
|
||||
const dacFxService = await this.getDaxFxService();
|
||||
|
||||
if ((<IDeploymentProfile>profile).upgradeExisting) {
|
||||
return await dacFxService.deployDacpac(dacpacPath, profile.databaseName, (<IDeploymentProfile>profile).upgradeExisting, profile.connectionUri, TaskExecutionMode.execute, profile.sqlCmdVariables);
|
||||
return await dacFxService.deployDacpac(tempPath, profile.databaseName, (<IDeploymentProfile>profile).upgradeExisting, profile.connectionUri, TaskExecutionMode.execute, profile.sqlCmdVariables);
|
||||
}
|
||||
else {
|
||||
return await dacFxService.generateDeployScript(dacpacPath, profile.databaseName, profile.connectionUri, TaskExecutionMode.script, profile.sqlCmdVariables);
|
||||
return await dacFxService.generateDeployScript(tempPath, profile.databaseName, profile.connectionUri, TaskExecutionMode.script, profile.sqlCmdVariables);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -511,7 +516,7 @@ export class ProjectsController {
|
||||
}
|
||||
}
|
||||
|
||||
private static async getDaxFxService(): Promise<mssql.IDacFxService> {
|
||||
public async getDaxFxService(): Promise<mssql.IDacFxService> {
|
||||
const ext: Extension<any> = extensions.getExtension(mssql.extension.name)!;
|
||||
|
||||
await ext.activate();
|
||||
|
||||
Reference in New Issue
Block a user