Add publish profile to sql proj and tree (#22008)

* Read publish profiles stored in sqlproj file and present it in the projects tree

* Save publish profile and add it to sqlproj file, and present it in the tree

* Fix context menu operations

* Add tests

* Address comments
This commit is contained in:
Sakshi Sharma
2023-02-23 22:32:12 -08:00
committed by GitHub
parent 91cdd610fd
commit 41e2767880
11 changed files with 267 additions and 14 deletions

View File

@@ -14,6 +14,7 @@ const localize = nls.loadMessageBundle();
export const dataSourcesFileName = 'datasources.json';
export const sqlprojExtension = '.sqlproj';
export const sqlFileExtension = '.sql';
export const publishProfileExtension = '.publish.xml';
export const openApiSpecFileExtensions = ['yaml', 'yml', 'json'];
export const schemaCompareExtensionId = 'microsoft.schema-compare';
export const master = 'master';
@@ -485,6 +486,7 @@ export const ImportElements = localize('importElements', "Import Elements");
export const ProjectReferenceNameElement = localize('projectReferenceNameElement', "Project reference name element");
export const ProjectReferenceElement = localize('projectReferenceElement', "Project reference");
export const DacpacReferenceElement = localize('dacpacReferenceElement', "Dacpac reference");
export const PublishProfileElements = localize('publishProfileElements', "Publish profile elements");
/** Name of the property item in the project file that defines default database collation. */
export const DefaultCollationProperty = 'DefaultCollation';

View File

@@ -771,3 +771,13 @@ export function isValidBasename(name?: string): boolean {
export function isValidBasenameErrorMessage(name?: string): string {
return getDataWorkspaceExtensionApi().isValidBasenameErrorMessage(name);
}
/**
* Checks if the provided file is a publish profile
* @param fileName filename to check
* @returns True if it is a publish profile, otherwise false
*/
export function isPublishProfile(fileName: string): boolean {
const hasPublishExtension = fileName.trim().toLowerCase().endsWith(constants.publishProfileExtension);
return hasPublishExtension;
}