mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Pass through database names to enable connection cleanup (#24251)
* Also re-ordered Attach entry to match context menu placement of other admin commands.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
||||||
"version": "4.9.0.26",
|
"version": "4.9.0.27",
|
||||||
"downloadFileNames": {
|
"downloadFileNames": {
|
||||||
"Windows_86": "win-x86-net7.0.zip",
|
"Windows_86": "win-x86-net7.0.zip",
|
||||||
"Windows_64": "win-x64-net7.0.zip",
|
"Windows_64": "win-x64-net7.0.zip",
|
||||||
|
|||||||
@@ -588,6 +588,11 @@
|
|||||||
"when": "connectionProvider == MSSQL && nodeType == Database && !isCloud && !(nodePath =~ /^.*\\/System Databases\\/.*$/) && config.workbench.enablePreviewFeatures && (productQualityType =~ /^(insider|dev)$/ || isDevelopment)",
|
"when": "connectionProvider == MSSQL && nodeType == Database && !isCloud && !(nodePath =~ /^.*\\/System Databases\\/.*$/) && config.workbench.enablePreviewFeatures && (productQualityType =~ /^(insider|dev)$/ || isDevelopment)",
|
||||||
"group": "1_objectManagement@2"
|
"group": "1_objectManagement@2"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"command": "mssql.attachDatabase",
|
||||||
|
"when": "connectionProvider == MSSQL && nodeType == Folder && objectType == Databases && !isCloud && config.workbench.enablePreviewFeatures",
|
||||||
|
"group": "1_objectManagement@2"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "mssql.dropDatabase",
|
"command": "mssql.dropDatabase",
|
||||||
"when": "connectionProvider == MSSQL && nodeType == Database && !(nodePath =~ /^.*\\/System Databases\\/.*$/) && config.workbench.enablePreviewFeatures",
|
"when": "connectionProvider == MSSQL && nodeType == Database && !(nodePath =~ /^.*\\/System Databases\\/.*$/) && config.workbench.enablePreviewFeatures",
|
||||||
@@ -598,11 +603,6 @@
|
|||||||
"when": "connectionProvider == MSSQL && nodeType =~ /^(ServerLevelLogin|User|ServerLevelServerRole|ApplicationRole|DatabaseRole)$/ && !(nodePath =~ /^.*\\/System Databases\\/.*$/) && config.workbench.enablePreviewFeatures",
|
"when": "connectionProvider == MSSQL && nodeType =~ /^(ServerLevelLogin|User|ServerLevelServerRole|ApplicationRole|DatabaseRole)$/ && !(nodePath =~ /^.*\\/System Databases\\/.*$/) && config.workbench.enablePreviewFeatures",
|
||||||
"group": "1_objectManagement@3"
|
"group": "1_objectManagement@3"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"command": "mssql.attachDatabase",
|
|
||||||
"when": "connectionProvider == MSSQL && nodeType == Folder && objectType == Databases && !isCloud && config.workbench.enablePreviewFeatures",
|
|
||||||
"group": "1_objectManagement"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"command": "mssql.enableGroupBySchema",
|
"command": "mssql.enableGroupBySchema",
|
||||||
"when": "connectionProvider == MSSQL && nodeType && nodeType =~ /^(Server|Database)$/ && !config.mssql.objectExplorer.groupBySchema",
|
"when": "connectionProvider == MSSQL && nodeType && nodeType =~ /^(Server|Database)$/ && !config.mssql.objectExplorer.groupBySchema",
|
||||||
|
|||||||
@@ -1652,6 +1652,7 @@ export namespace SearchObjectRequest {
|
|||||||
|
|
||||||
export interface DetachDatabaseRequestParams {
|
export interface DetachDatabaseRequestParams {
|
||||||
connectionUri: string;
|
connectionUri: string;
|
||||||
|
database: string;
|
||||||
objectUrn: string;
|
objectUrn: string;
|
||||||
dropConnections: boolean;
|
dropConnections: boolean;
|
||||||
updateStatistics: boolean;
|
updateStatistics: boolean;
|
||||||
@@ -1664,6 +1665,7 @@ export namespace DetachDatabaseRequest {
|
|||||||
|
|
||||||
export interface DropDatabaseRequestParams {
|
export interface DropDatabaseRequestParams {
|
||||||
connectionUri: string;
|
connectionUri: string;
|
||||||
|
database: string;
|
||||||
objectUrn: string;
|
objectUrn: string;
|
||||||
dropConnections: boolean;
|
dropConnections: boolean;
|
||||||
deleteBackupHistory: boolean;
|
deleteBackupHistory: boolean;
|
||||||
|
|||||||
6
extensions/mssql/src/mssql.d.ts
vendored
6
extensions/mssql/src/mssql.d.ts
vendored
@@ -977,13 +977,14 @@ declare module 'mssql' {
|
|||||||
/**
|
/**
|
||||||
* Detach a database.
|
* Detach a database.
|
||||||
* @param connectionUri The URI of the server connection.
|
* @param connectionUri The URI of the server connection.
|
||||||
|
* @param database The target database.
|
||||||
* @param objectUrn SMO Urn of the database to be detached. More information: https://learn.microsoft.com/sql/relational-databases/server-management-objects-smo/overview-smo
|
* @param objectUrn SMO Urn of the database to be detached. More information: https://learn.microsoft.com/sql/relational-databases/server-management-objects-smo/overview-smo
|
||||||
* @param dropConnections Whether to drop active connections to this database.
|
* @param dropConnections Whether to drop active connections to this database.
|
||||||
* @param updateStatistics Whether to update the optimization statistics related to this database.
|
* @param updateStatistics Whether to update the optimization statistics related to this database.
|
||||||
* @param generateScript Whether to generate a TSQL script for the operation instead of detaching the database.
|
* @param generateScript Whether to generate a TSQL script for the operation instead of detaching the database.
|
||||||
* @returns A string value representing the generated TSQL query if generateScript was set to true, and an empty string otherwise.
|
* @returns A string value representing the generated TSQL query if generateScript was set to true, and an empty string otherwise.
|
||||||
*/
|
*/
|
||||||
detachDatabase(connectionUri: string, objectUrn: string, dropConnections: boolean, updateStatistics: boolean, generateScript: boolean): Thenable<string>;
|
detachDatabase(connectionUri: string, database: string, objectUrn: string, dropConnections: boolean, updateStatistics: boolean, generateScript: boolean): Thenable<string>;
|
||||||
/**
|
/**
|
||||||
* Attach one or more databases.
|
* Attach one or more databases.
|
||||||
* @param connectionUri The URI of the server connection.
|
* @param connectionUri The URI of the server connection.
|
||||||
@@ -995,13 +996,14 @@ declare module 'mssql' {
|
|||||||
/**
|
/**
|
||||||
* Drop a database.
|
* Drop a database.
|
||||||
* @param connectionUri The URI of the server connection.
|
* @param connectionUri The URI of the server connection.
|
||||||
|
* @param database The target database.
|
||||||
* @param objectUrn SMO Urn of the database to be detached. More information: https://learn.microsoft.com/sql/relational-databases/server-management-objects-smo/overview-smo
|
* @param objectUrn SMO Urn of the database to be detached. More information: https://learn.microsoft.com/sql/relational-databases/server-management-objects-smo/overview-smo
|
||||||
* @param dropConnections Whether to drop active connections to this database.
|
* @param dropConnections Whether to drop active connections to this database.
|
||||||
* @param deleteBackupHistory Whether to delete backup and restore history information for this database.
|
* @param deleteBackupHistory Whether to delete backup and restore history information for this database.
|
||||||
* @param generateScript Whether to generate a TSQL script for the operation instead of detaching the database.
|
* @param generateScript Whether to generate a TSQL script for the operation instead of detaching the database.
|
||||||
* @returns A string value representing the generated TSQL query if generateScript was set to true, and an empty string otherwise.
|
* @returns A string value representing the generated TSQL query if generateScript was set to true, and an empty string otherwise.
|
||||||
*/
|
*/
|
||||||
dropDatabase(connectionUri: string, objectUrn: string, dropConnections: boolean, deleteBackupHistory: boolean, generateScript: boolean): Thenable<string>;
|
dropDatabase(connectionUri: string, database: string, objectUrn: string, dropConnections: boolean, deleteBackupHistory: boolean, generateScript: boolean): Thenable<string>;
|
||||||
/**
|
/**
|
||||||
* Gets the file path for the default database file folder for a SQL Server instance.
|
* Gets the file path for the default database file folder for a SQL Server instance.
|
||||||
* @param connectionUri The URI of the connection for the specific server.
|
* @param connectionUri The URI of the connection for the specific server.
|
||||||
|
|||||||
@@ -66,13 +66,13 @@ export class ObjectManagementService extends BaseService implements IObjectManag
|
|||||||
return this.runWithErrorHandling(contracts.SearchObjectRequest.type, params);
|
return this.runWithErrorHandling(contracts.SearchObjectRequest.type, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
async detachDatabase(connectionUri: string, objectUrn: string, dropConnections: boolean, updateStatistics: boolean, generateScript: boolean): Promise<string> {
|
async detachDatabase(connectionUri: string, database: string, objectUrn: string, dropConnections: boolean, updateStatistics: boolean, generateScript: boolean): Promise<string> {
|
||||||
const params: contracts.DetachDatabaseRequestParams = { connectionUri, objectUrn, dropConnections, updateStatistics, generateScript };
|
const params: contracts.DetachDatabaseRequestParams = { connectionUri, database, objectUrn, dropConnections, updateStatistics, generateScript };
|
||||||
return this.runWithErrorHandling(contracts.DetachDatabaseRequest.type, params);
|
return this.runWithErrorHandling(contracts.DetachDatabaseRequest.type, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
async dropDatabase(connectionUri: string, objectUrn: string, dropConnections: boolean, deleteBackupHistory: boolean, generateScript: boolean): Promise<string> {
|
async dropDatabase(connectionUri: string, database: string, objectUrn: string, dropConnections: boolean, deleteBackupHistory: boolean, generateScript: boolean): Promise<string> {
|
||||||
const params: contracts.DropDatabaseRequestParams = { connectionUri, objectUrn, dropConnections, deleteBackupHistory, generateScript };
|
const params: contracts.DropDatabaseRequestParams = { connectionUri, database, objectUrn, dropConnections, deleteBackupHistory, generateScript };
|
||||||
return this.runWithErrorHandling(contracts.DropDatabaseRequest.type, params);
|
return this.runWithErrorHandling(contracts.DropDatabaseRequest.type, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,7 +257,7 @@ export class TestObjectManagementService implements IObjectManagementService {
|
|||||||
return this.delayAndResolve(items);
|
return this.delayAndResolve(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
async detachDatabase(connectionUri: string, objectUrn: string, dropConnections: boolean, updateStatistics: boolean, generateScript: boolean): Promise<string> {
|
async detachDatabase(connectionUri: string, database: string, objectUrn: string, dropConnections: boolean, updateStatistics: boolean, generateScript: boolean): Promise<string> {
|
||||||
return this.delayAndResolve('');
|
return this.delayAndResolve('');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,7 +265,7 @@ export class TestObjectManagementService implements IObjectManagementService {
|
|||||||
return this.delayAndResolve('');
|
return this.delayAndResolve('');
|
||||||
}
|
}
|
||||||
|
|
||||||
dropDatabase(connectionUri: string, objectUrn: string, dropConnections: boolean, deleteBackupHistory: boolean, generateScript: boolean): Thenable<string> {
|
dropDatabase(connectionUri: string, database: string, objectUrn: string, dropConnections: boolean, deleteBackupHistory: boolean, generateScript: boolean): Thenable<string> {
|
||||||
return this.delayAndResolve('');
|
return this.delayAndResolve('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,11 +45,11 @@ export class DetachDatabaseDialog extends ObjectManagementDialogBase<Database, D
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override async saveChanges(contextId: string, object: ObjectManagement.SqlObject): Promise<void> {
|
protected override async saveChanges(contextId: string, object: ObjectManagement.SqlObject): Promise<void> {
|
||||||
await this.objectManagementService.detachDatabase(this.options.connectionUri, this.options.objectUrn, this._dropConnections, this._updateStatistics, false);
|
await this.objectManagementService.detachDatabase(this.options.connectionUri, this.options.database, this.options.objectUrn, this._dropConnections, this._updateStatistics, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async generateScript(): Promise<string> {
|
protected override async generateScript(): Promise<string> {
|
||||||
return await this.objectManagementService.detachDatabase(this.options.connectionUri, this.options.objectUrn, this._dropConnections, this._updateStatistics, true);
|
return await this.objectManagementService.detachDatabase(this.options.connectionUri, this.options.database, this.options.objectUrn, this._dropConnections, this._updateStatistics, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async validateInput(): Promise<string[]> {
|
protected override async validateInput(): Promise<string[]> {
|
||||||
|
|||||||
@@ -49,11 +49,11 @@ export class DropDatabaseDialog extends ObjectManagementDialogBase<Database, Dat
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override async saveChanges(contextId: string, object: ObjectManagement.SqlObject): Promise<void> {
|
protected override async saveChanges(contextId: string, object: ObjectManagement.SqlObject): Promise<void> {
|
||||||
await this.objectManagementService.dropDatabase(this.options.connectionUri, this.options.objectUrn, this._dropConnections, this._deleteBackupHistory, false);
|
await this.objectManagementService.dropDatabase(this.options.connectionUri, this.options.database, this.options.objectUrn, this._dropConnections, this._deleteBackupHistory, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async generateScript(): Promise<string> {
|
protected override async generateScript(): Promise<string> {
|
||||||
return await this.objectManagementService.dropDatabase(this.options.connectionUri, this.options.objectUrn, this._dropConnections, this._deleteBackupHistory, true);
|
return await this.objectManagementService.dropDatabase(this.options.connectionUri, this.options.database, this.options.objectUrn, this._dropConnections, this._deleteBackupHistory, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async validateInput(): Promise<string[]> {
|
protected override async validateInput(): Promise<string[]> {
|
||||||
|
|||||||
Reference in New Issue
Block a user