Skip to content

Commit

Permalink
Fix for issue where bulk-adding scripts could perform a rescan after …
Browse files Browse the repository at this point in the history
…each script (#22665) (#22667)

* Changed bulk script add to delay reloading file list until end of operation.

* Adding style name to sqlproj typing file

* vBump to 1.0.1
  • Loading branch information
Benjin committed Apr 11, 2023
1 parent b790d70 commit 09b1554
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion extensions/sql-database-projects/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "sql-database-projects",
"displayName": "SQL Database Projects",
"description": "Enables users to develop and publish database schemas for MSSQL Databases",
"version": "1.0.0",
"version": "1.0.1",
"publisher": "Microsoft",
"preview": false,
"engines": {
Expand Down
17 changes: 13 additions & 4 deletions extensions/sql-database-projects/src/models/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ export class Project implements ISqlProject {
return this._sqlProjStyle;
}

public get sqlProjStyleName(): string {
return this.sqlProjStyle === ProjectType.SdkStyle ? 'SdkStyle' : 'LegacyStyle';
}

public get isCrossPlatformCompatible(): boolean {
return this._isCrossPlatformCompatible;
}
Expand Down Expand Up @@ -494,18 +498,23 @@ export class Project implements ISqlProject {

//#region SQL object scripts

public async addSqlObjectScript(relativePath: string): Promise<void> {
public async addSqlObjectScript(relativePath: string, reloadAfter: boolean = true): Promise<void> {
const result = await this.sqlProjService.addSqlObjectScript(this.projectFilePath, relativePath);
this.throwIfFailed(result);

await this.readFilesInProject();
await this.readFolders();
if (reloadAfter) {
await this.readFilesInProject();
await this.readFolders();
}
}

public async addSqlObjectScripts(relativePaths: string[]): Promise<void> {
for (const path of relativePaths) {
await this.addSqlObjectScript(path);
await this.addSqlObjectScript(path, false /* reloadAfter */);
}

await this.readFilesInProject();
await this.readFolders();
}

public async deleteSqlObjectScript(relativePath: string): Promise<void> {
Expand Down
5 changes: 5 additions & 0 deletions extensions/sql-database-projects/src/sqldbproj.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ declare module 'sqldbproj' {
*/
getDatabaseDefaultCollation(): string;

/**
* Type of .sqlproj file, either "SdkStyle" or "LegacyStyle"
*/
readonly sqlProjStyleName: string;

/**
* Path where dacpac is output to after a successful build
*/
Expand Down

0 comments on commit 09b1554

Please sign in to comment.