Add sql proj schema compare for dacpac (#10388)

* add support for schema compare to specify source dacpac

* add build and dacpac produced from build

* check if dacpac exists

* add tests

* move exists check code to utils

* fix test run failing
This commit is contained in:
Kim Santiago
2020-05-15 13:03:08 -07:00
committed by GitHub
parent ef4ab4a59f
commit b83279c24c
7 changed files with 97 additions and 1 deletions

View File

@@ -138,6 +138,27 @@ export class ProjectsController {
deployDatabaseDialog.openDialog();
}
public async schemaCompare(treeNode: BaseProjectTreeItem): Promise<void> {
// check if schema compare extension is installed
if (this.apiWrapper.getExtension(constants.schemaCompareExtensionId)) {
// build project
await this.buildProject(treeNode);
// start schema compare with the dacpac produced from build
const project = this.getProjectContextFromTreeNode(treeNode);
const dacpacPath = path.join(project.projectFolderPath, 'bin', 'Debug', `${project.projectFileName}.dacpac`);
// check that dacpac exists
if (await utils.exists(dacpacPath)) {
this.apiWrapper.executeCommand('schemaCompare.start', dacpacPath);
} else {
this.apiWrapper.showErrorMessage(constants.buildDacpacNotFound);
}
} else {
this.apiWrapper.showErrorMessage(constants.schemaCompareNotInstalled);
}
}
public async import(treeNode: BaseProjectTreeItem) {
const project = this.getProjectContextFromTreeNode(treeNode);
await this.apiWrapper.showErrorMessage(`Import not yet implemented: ${project.projectFilePath}`); // TODO