set includeCompositeObjects to true if there are database references (#12641)

This commit is contained in:
Kim Santiago
2020-09-30 10:58:35 -07:00
committed by GitHub
parent b3578d058f
commit 5681d6b9e3
3 changed files with 29 additions and 9 deletions

View File

@@ -183,7 +183,7 @@ export class PublishDatabaseDialog {
upgradeExisting: true,
connectionUri: await this.getConnectionUri(),
sqlCmdVariables: sqlCmdVars,
deploymentOptions: this.deploymentOptions
deploymentOptions: await this.getDeploymentOptions()
};
azdata.window.closeDialog(this.dialog);
@@ -198,7 +198,7 @@ export class PublishDatabaseDialog {
databaseName: this.getTargetDatabaseName(),
connectionUri: await this.getConnectionUri(),
sqlCmdVariables: sqlCmdVars,
deploymentOptions: this.deploymentOptions
deploymentOptions: await this.getDeploymentOptions()
};
azdata.window.closeDialog(this.dialog);
@@ -210,6 +210,21 @@ export class PublishDatabaseDialog {
this.dispose();
}
private async getDeploymentOptions(): Promise<DeploymentOptions> {
// eventually, database options will be configurable in this dialog
// but for now, just send the default DacFx deployment options if no options were loaded from a publish profile
if (!this.deploymentOptions) {
this.deploymentOptions = await utils.GetDefaultDeploymentOptions();
// this option needs to be true for same database references validation to work
if (this.project.databaseReferences.length > 0) {
this.deploymentOptions.includeCompositeObjects = true;
}
}
return this.deploymentOptions;
}
private getSqlCmdVariablesForPublish(): Record<string, string> {
// get SQLCMD variables from table
let sqlCmdVariables = { ...this.sqlCmdVars };