mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 09:35:39 -05:00
SQL Database Projects backend swap to DacFx/Tools Service (#22451)
* Move call to STS move api into project.ts (#22071) * move call to STS move api into project.ts * remove undefined * Remove convert to sdk style code (#22081) * remove convert to sdk style code * remove from package.json * Merging latest from main (#22097) * [SQL-Migration] Login migrations telemetry (#22038) This PR enhances telemetry for login migrations (and in the following ways: Add details for starting migration (number of logins migrating, type of logins) Log Migration result (number of errors per step, duration of each step, type of logins, if system error occurred) Add sql-migration extension to our telemetry Adds details when trying to connect to target Tracks clicking "done" from the wizard Fixes bucketizing for navigating telemetry in the login migration wizard Sample usage of kusto query for new telemetry: RawEventsADS | where EventName contains 'sql-migration' | extend view = tostring(Properties['view']) | extend action = tostring(Properties['action']) | extend buttonPressed = tostring(Properties['buttonpressed']) | extend pageTitle = tostring(Properties['pagetitle']) | extend adsVersion = tostring(Properties['common.adsversion']) | extend targetType = tostring(Properties['targettype']) | extend tenantId = tostring(Properties['tenantid']) | extend subscriptionId = tostring(Properties['subscriptionid']) | where view contains "login" //| where adsVersion contains "1.42.0-insider" | where ClientTimestamp >= ago(18h) | project EventName, ClientTimestamp, SessionId, view, pageTitle, action, buttonPressed, targetType , tenantId, subscriptionId , adsVersion, OSVersion, Properties * Add Secure Enclaves dropdown with customizable Advanced options (#22019) * Update extension READMEs (#22079) * Fix query-history README images (#22084) * [Loc] update to mssql and sql-migration xlf files (#22087) * [Loc] small fix to Portuguese lcl file (#22088) * [Loc] small fix to Portuguese lcl file * remove newline * Adding None bindings to the sqlProjects service (#22085) * Adding None bindings * updating names of None bindings --------- Co-authored-by: AkshayMata <akam520@gmail.com> Co-authored-by: Cheena Malhotra <13396919+cheenamalhotra@users.noreply.github.com> Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> Co-authored-by: Alex Ma <alma1@microsoft.com> * Swap add and update sqlcmd variables in sql projects to use STS apis (#22086) * delete sqlcmd variable working * undo add * remove variable from add and update sqlcmd variable apis * hookup add and edit sqlcmd variable * update vscode-mssql.d.ts * move add and edit to project.ts * update STS and tests * move delete sqlcmd variable to project.ts (#22104) * add test for add and edit sqlcmd variable (#22107) * Swapping property access to STS (#22115) * checkpoint * Adding sqlproj property bindings * Swapping out property loading and setting * consolidating to this.sqlProjService * Update dacpac reference to use STS api (#22116) * Update add dacpac reference to use STS api * remove changes for project ref * validate unset settings from add database reference dialog * update one more place getting sqlprojservice * addressing comments * fix path for dacpac reference (#22143) * Swap add project reference to call STS (#22148) * initial changes for swapping add project reference * fix include path * move common logic to helper function * read sqlcmd variables from STS (#22147) * Swapping .sqlproj- and crossplat compatibility-related functions to use STS (#22146) * Supporting roundtrip * Updating sqlproj style checks and cross-platform compatibility to use STS * removing unnecessary awaits * Fixing assertions * Adding roundtrip update confirmations * test cleanup * cleaning up comment; localizing error * Swap add system db reference (#22171) * swap adding system database references * fix tests * remove only in test * Read database references from STS (#22179) * Read database references from STS * fix system dacpac names * fix project reference name * Swap changeTargetPlatform to call STS (#22172) * swap changeTargetPlatform to call STS * Address comments * De-duplicating enum for SystemDatabase (#22196) * Deudping SystemDatabase enum * simplifying enum refs * Removing the now-unused imports code from SqlProjects (#22199) * Removing unused importTargets entries * whitespace; also to retrigger github checks on correct branch * Hooking in Move() for Nones and PublishProfiles (#22200) * Swap delete database reference to call STS (#22215) * initial changes * update contracts * remove unnecessary info from SystemDatabaseReferenceProjectEntry * uppercase master and msdb * cleanup * update test * update comment * undo change in projectController.ts * remove unused system dacpac helper functions (#22204) * more cleanup of project.ts (#22242) * fix a couple database reference tests (#22248) * Organizing sqlcmd variable and db reference code (#22284) * organize database references and sqlcmd variable functions * separate database reference tests * Script and folder get + add support (#22166) * Initial sqlobjectscripts * adding mock filter * test fixing * another test passing * swapping pre/post/none checkpoint * awaiters * convert addExistingItem * swapping folders * removing print * stripping out project folder and file readers * adding some regions * Updating sqlproj style checks and cross-platform compatibility to use STS * Updating sqlproj style checks and cross-platform compatibility to use STS * added type property to tree items * projectController swapovers * removing imported targets * Deleting the last of the TS XML parsing! * Removing old functions * renamed readNoneScripts to readNoneItems * fixing path passed to STS calls * remove system dacpac tests that were moved to DacFx (#22299) * fix error when opening file after adding a file to sql project (#22309) * fix error when opening file after adding a file to sql project * remove unused import * fix exclude for table and externalStreamingJob (#22310) * add reload project (#22313) * set DSP from STS (#22320) * fix adding post-deployment script and existing item (#22317) * Test cleanup for .sqlproj content operations (#22330) * Fixing up tests * sqlproj content operations tests * remove only * Cleanup * Correcting collation * cleanup constants.ts (#22336) * fix folders not showing in project tree (#22319) * Fix project controller tests (#22327) * fixing ProjectController tests after swap * remove only from database reference tests * change system dbs back to lowercase in sql projects (#22353) * Bump tools service * Updated yarn.lock file * pass SystemDacpacsLocation when building legacy style sql projects (#22329) * Benjin/fix types (#22365) * Updated yarn.lock file * Fixing types * fix projectController tests (#22375) * Fixing the deletion flow for files and folders (#22366) * checkpoint * PR feedback * Fixing up SDK-style operations project test group (#22377) * Fixing up SDK-style project test group * Removing .only * Fixing up database reference tests (#22380) * Fixing DB reference test group * Extra cleanup * removing only * Consolidating None and PublishProfile; lighting up test (#22382) * Lighting up project property tests (#22395) * Checkpoint * Lighting up project property tests * removing timeout * Fixing buildHelper test (#22400) * Unskipping up roundtrip test (#22397) * Refactoring database references to split literalVariable from databaseName (#22412) * refactoring database references to split databaseVariableLiteralValue out from databaseName * renaming more properties * Removing branch in entry population * removing only * Fixing baselines for delete test * PR feedback * Fixing up ProjectTree tests (#22419) * Fixing up projectTree tests * remove only * Updating projectController exclude test (#22413) * Updating test * moving filtering for external folders to readFolders() method * Removing EntryType import * fix ups (#22435) * adding extra info for test failure * hide exclude folder from context menu until it's supported (#22454) * Adding current test name to generated folder to avoid conflicts (#22478) * Adding current test name to generated folder to avoid conflicts * passing correct test parameter in * Adding trimming and entropy * Deleting unused baselines (#22497) * Replacing addToProject() with addSqlObjectScripts() (#22489) * checkpoint * Fixing test * Updating file scraper function to filter only to .sql files (no folders, no txt) * changing var names to reflect that the lists only contain .sql scripts --------- Co-authored-by: Kim Santiago <31145923+kisantia@users.noreply.github.com> Co-authored-by: AkshayMata <akam520@gmail.com> Co-authored-by: Cheena Malhotra <13396919+cheenamalhotra@users.noreply.github.com> Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> Co-authored-by: Alex Ma <alma1@microsoft.com>
This commit is contained in:
@@ -10,23 +10,26 @@ import * as utils from '../common/utils';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
// Placeholder values
|
||||
//#region file extensions
|
||||
export const dataSourcesFileName = 'datasources.json';
|
||||
export const sqlprojExtension = '.sqlproj';
|
||||
export const sqlFileExtension = '.sql';
|
||||
export const publishProfileExtension = '.publish.xml';
|
||||
export const openApiSpecFileExtensions = ['yaml', 'yml', 'json'];
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Placeholder values
|
||||
export const schemaCompareExtensionId = 'microsoft.schema-compare';
|
||||
export const master = 'master';
|
||||
export const masterDacpac = 'master.dacpac';
|
||||
export const msdb = 'msdb';
|
||||
export const msdbDacpac = 'msdb.dacpac';
|
||||
export const MicrosoftDatatoolsSchemaSqlSql = 'Microsoft.Data.Tools.Schema.Sql.Sql';
|
||||
export const databaseSchemaProvider = 'DatabaseSchemaProvider';
|
||||
export const sqlProjectSdk = 'Microsoft.Build.Sql';
|
||||
export const sqlProjectSdkVersion = '0.1.7-preview';
|
||||
|
||||
// Project Provider
|
||||
//#endregion
|
||||
|
||||
//#region Project Provider
|
||||
export const emptySqlDatabaseProjectTypeId = 'EmptySqlDbProj';
|
||||
export const emptyProjectTypeDisplayName = localize('emptyProjectTypeDisplayName', "SQL Server Database");
|
||||
export const emptyProjectTypeDescription = localize('emptyProjectTypeDescription', "Develop and publish schemas for SQL Server databases starting from an empty project");
|
||||
@@ -43,7 +46,9 @@ export const emptyAzureDbSqlDatabaseProjectTypeId = 'EmptyAzureSqlDbProj';
|
||||
export const emptyAzureDbProjectTypeDisplayName = localize('emptyAzureDbProjectTypeDisplayName', "Azure SQL Database");
|
||||
export const emptyAzureDbProjectTypeDescription = localize('emptyAzureDbProjectTypeDescription', "Develop and publish schemas for Azure SQL Database starting from an empty project");
|
||||
|
||||
// Dashboard
|
||||
//#endregion
|
||||
|
||||
//#region Dashboard
|
||||
export const addItemAction = localize('addItemAction', "Add Item");
|
||||
export const schemaCompareAction = localize('schemaCompareAction', "Schema Compare");
|
||||
export const buildAction = localize('buildAction', "Build");
|
||||
@@ -70,14 +75,18 @@ export const msec = localize('msec', "msec");
|
||||
|
||||
export const at = localize('at', "at");
|
||||
|
||||
// commands
|
||||
//#endregion
|
||||
|
||||
//#region commands
|
||||
export const revealFileInOsCommand = 'revealFileInOS';
|
||||
export const schemaCompareStartCommand = 'schemaCompare.start';
|
||||
export const schemaCompareRunComparisonCommand = 'schemaCompare.runComparison';
|
||||
export const vscodeOpenCommand = 'vscode.open';
|
||||
export const refreshDataWorkspaceCommand = 'dataworkspace.refresh';
|
||||
|
||||
// UI Strings
|
||||
//#endregion
|
||||
|
||||
//#region UI Strings
|
||||
export const databaseReferencesNodeName = localize('databaseReferencesNodeName', "Database References");
|
||||
export const sqlcmdVariablesNodeName = localize('sqlcmdVariablesNodeName', "SQLCMD Variables");
|
||||
export const sqlConnectionStringFriendly = localize('sqlConnectionStringFriendly', "SQL connection string");
|
||||
@@ -112,8 +121,11 @@ export function projectUpdatedToSdkStyle(projectName: string) { return localize(
|
||||
export function convertToSdkStyleConfirmation(projectName: string) { return localize('convertToSdkStyleConfirmation', "The project '{0}' will not be fully compatible with SSDT after conversion. A backup copy of the project file will be created in the project folder prior to conversion. More information is available at https://aka.ms/sqlprojsdk. Continue with converting to SDK-style project?", projectName); }
|
||||
export function updatedToSdkStyleError(projectName: string) { return localize('updatedToSdkStyleError', "Converting the project {0} to SDK-style was unsuccessful. Changes to the .sqlproj have been rolled back.", projectName); }
|
||||
export const enterNewName = localize('enterNewName', "Enter new name");
|
||||
//#endregion
|
||||
|
||||
// Publish dialog strings
|
||||
export const reservedProjectFolders = ['Properties', 'SQLCMD Variables', 'Database References'];
|
||||
|
||||
//#region Publish dialog strings
|
||||
export const publishDialogName = localize('publishDialogName', "Publish project");
|
||||
export const publish = localize('publish', "Publish");
|
||||
export const cancelButtonText = localize('cancelButtonText', "Cancel");
|
||||
@@ -152,7 +164,9 @@ export const selectDatabase = localize('selectDatabase', "Select database");
|
||||
export const done = localize('done', "Done");
|
||||
export const nameMustNotBeEmpty = localize('nameMustNotBeEmpty', "Name must not be empty");
|
||||
|
||||
// Publish Dialog options
|
||||
//#endregion
|
||||
|
||||
//#region Publish Dialog options
|
||||
export const AdvancedOptionsButton = localize('advancedOptionsButton', 'Advanced...');
|
||||
export const AdvancedPublishOptions = localize('advancedPublishOptions', 'Advanced Publish Options');
|
||||
export const PublishOptions = localize('publishOptions', 'Publish Options');
|
||||
@@ -163,7 +177,9 @@ export const OptionName: string = localize('optionName', "Option Name");
|
||||
export const OptionInclude: string = localize('include', "Include");
|
||||
export function OptionNotFoundWarningMessage(label: string) { return localize('optionNotFoundWarningMessage', "label: {0} does not exist in the options value name lookup", label); }
|
||||
|
||||
// Deploy
|
||||
//#endregion
|
||||
|
||||
//#region Deploy
|
||||
export const SqlServerName = 'SQL server';
|
||||
export const AzureSqlServerName = 'Azure SQL server';
|
||||
export const SqlServerDockerImageName = 'Microsoft SQL Server';
|
||||
@@ -206,7 +222,9 @@ export const dockerImageLabelPrefix = 'source=sqldbproject';
|
||||
export const dockerImageNamePrefix = 'sqldbproject';
|
||||
export const dockerImageDefaultTag = 'latest';
|
||||
|
||||
// Publish to Container
|
||||
//#endregion
|
||||
|
||||
//#region Publish to Container
|
||||
export const eulaAgreementTemplate = localize({ key: 'eulaAgreementTemplate', comment: ['The placeholders are contents of the line and should not be translated.'] }, "I accept the {0}.");
|
||||
export function eulaAgreementText(name: string) { return localize({ key: 'eulaAgreementText', comment: ['The placeholders are contents of the line and should not be translated.'] }, "I accept the {0}.", name); }
|
||||
export const eulaAgreementTitle = localize('eulaAgreementTitle', "Microsoft SQL Server License Agreement");
|
||||
@@ -262,8 +280,9 @@ export function retrySucceedMessage(name: string, result: string) { return local
|
||||
export function retryFailedMessage(name: string, result: string, error: string) { return localize('retryFailedMessage', "Operation '{0}' failed. Re-trying... Current Result: {1}. Error: '{2}'", name, result, error); }
|
||||
export function retryMessage(name: string, error: string) { return localize('retryMessage', "Operation '{0}' failed. Re-trying... Error: '{1}' ", name, error); }
|
||||
|
||||
// Add Database Reference dialog strings
|
||||
//#endregion
|
||||
|
||||
//#region Add Database Reference dialog strings
|
||||
export const addDatabaseReferenceDialogName = localize('addDatabaseReferencedialogName', "Add database reference");
|
||||
export const addDatabaseReferenceOkButtonText = localize('addDatabaseReferenceOkButtonText', "Add reference");
|
||||
export const referenceRadioButtonsGroupTitle = localize('referenceRadioButtonsGroupTitle', "Type");
|
||||
@@ -291,8 +310,13 @@ export const databaseProject = localize('databaseProject', "Database project");
|
||||
export const dacpacMustBeOnSameDrive = localize('dacpacNotOnSameDrive', "Dacpac references need to be located on the same drive as the project file.");
|
||||
export const dacpacNotOnSameDrive = (projectLocation: string): string => { return localize('dacpacNotOnSameDrive', "Dacpac references need to be located on the same drive as the project file. The project file is located at {0}", projectLocation); };
|
||||
export const referenceType = localize('referenceType', "Reference type");
|
||||
export const excludeFolderNotSupported = localize('excludeFolderNotSupported', "Excluding folders is not yet supported");
|
||||
export const unhandledDeleteType = (itemType: string): string => { return localize('unhandledDeleteType', "Unhandled item type during delete: '{0}", itemType); }
|
||||
export const unhandledExcludeType = (itemType: string): string => { return localize('unhandledDeleteType', "Unhandled item type during exclude: '{0}", itemType); }
|
||||
|
||||
// Create Project From Database dialog strings
|
||||
//#endregion
|
||||
|
||||
//#region Create Project From Database dialog strings
|
||||
export const createProjectFromDatabaseDialogName = localize('createProjectFromDatabaseDialogName', "Create project from database");
|
||||
export const createProjectDialogOkButtonText = localize('createProjectDialogOkButtonText', "Create");
|
||||
export const sourceDatabase = localize('sourceDatabase', "Source database");
|
||||
@@ -307,7 +331,6 @@ export const selectFolderStructure = localize('selectFolderStructure', "Select f
|
||||
export const folderStructureLabel = localize('folderStructureLabel', "Folder structure");
|
||||
export const includePermissionsLabel = localize('includePermissionsLabel', "Include permissions");
|
||||
export const includePermissionsInProject = localize('includePermissionsInProject', "Include permissions in project");
|
||||
export const WorkspaceFileExtension = '.code-workspace';
|
||||
export const browseEllipsisWithIcon = `$(folder) ${localize('browseEllipsis', "Browse...")}`;
|
||||
export const selectProjectLocation = localize('selectProjectLocation', "Select project location");
|
||||
export const sdkStyleProject = localize('sdkStyleProject', 'SDK-style project (Preview)');
|
||||
@@ -316,8 +339,9 @@ export const SdkLearnMorePlaceholder = localize('sdkLearnMorePlaceholder', "Clic
|
||||
export const ProjectParentDirectoryNotExistError = (location: string): string => { return localize('dataworkspace.projectParentDirectoryNotExistError', "The selected project location '{0}' does not exist or is not a directory.", location); };
|
||||
export const ProjectDirectoryAlreadyExistError = (projectName: string, location: string): string => { return localize('dataworkspace.projectDirectoryAlreadyExistError', "There is already a directory named '{0}' in the selected location: '{1}'.", projectName, location); };
|
||||
|
||||
// Update Project From Database dialog strings
|
||||
//#endregion
|
||||
|
||||
//#region Update Project From Database dialog strings
|
||||
export const updateProjectFromDatabaseDialogName = localize('updateProjectFromDatabaseDialogName', "Update project from database");
|
||||
export const updateText = localize('updateText', "Update");
|
||||
export const noSqlProjFile = localize('noSqlProjFile', "The selected project file does not exist");
|
||||
@@ -329,15 +353,18 @@ export const updateActionRadioButtonLabel = localize('updateActionRadiButtonLabe
|
||||
export const actionLabel = localize('actionLabel', "Action");
|
||||
export const applyConfirmation: string = localize('applyConfirmation', "Are you sure you want to update the target project?");
|
||||
|
||||
// Update project from database
|
||||
//#endregion
|
||||
|
||||
//#region Update project from database
|
||||
export const applySuccess = localize('applySuccess', "Project was successfully updated.");
|
||||
export const equalComparison = localize('equalComparison', "The project is already up to date with the database.");
|
||||
export function applyError(errorMessage: string): string { return localize('applyError', "There was an error updating the project: {0}", errorMessage); }
|
||||
export function updatingProjectFromDatabase(projectName: string, databaseName: string): string { return localize('updatingProjectFromDatabase', "Updating {0} from {1}...", projectName, databaseName); }
|
||||
|
||||
// Error messages
|
||||
//#endregion
|
||||
|
||||
//#region Error messages
|
||||
export function errorPrefix(errorMessage: string): string { return localize('errorPrefix', "Error: {0}", errorMessage); }
|
||||
export function compareErrorMessage(errorMessage: string): string { return localize('schemaCompare.compareErrorMessage', "Schema Compare failed: {0}", errorMessage ? errorMessage : 'Unknown'); }
|
||||
export const multipleSqlProjFiles = localize('multipleSqlProjFilesSelected', "Multiple .sqlproj files selected; please select only one.");
|
||||
export const noSqlProjFiles = localize('noSqlProjFilesSelected', "No .sqlproj file selected; please select one.");
|
||||
@@ -391,7 +418,11 @@ export function unableToFindSqlCmdVariable(variableName: string) { return locali
|
||||
export function unableToFindDatabaseReference(reference: string) { return localize('unableToFindReference', "Unable to find database reference {0}", reference); }
|
||||
export function invalidGuid(guid: string) { return localize('invalidGuid', "Specified GUID is invalid: {0}", guid); }
|
||||
export function invalidTargetPlatform(targetPlatform: string, supportedTargetPlatforms: string[]) { return localize('invalidTargetPlatform', "Invalid target platform: {0}. Supported target platforms: {1}", targetPlatform, supportedTargetPlatforms.toString()); }
|
||||
export function errorReadingProject(section: string, path: string) { return localize('errorReadingProjectGuid', "Error trying to read {0} of project '{1}'", section, path); }
|
||||
export function errorReadingProject(section: string, path: string, error?: string) { return localize('errorReadingProjectGuid', "Error trying to read {0} of project '{1}'. {2}", section, path, error); }
|
||||
export function errorAddingDatabaseReference(referenceName: string, error: string) { return localize('errorAddingDatabaseReference', "Error adding database reference to {0}. Error: {1}", referenceName, error); }
|
||||
export function errorNotSupportedInVsCode(actionDescription: string) { return localize('errorNotSupportedInVsCode', "Error: {0} is not currently supported in SQL Database Projects for VS Code.", actionDescription); }
|
||||
|
||||
//#endregion
|
||||
|
||||
// Action types
|
||||
export const deleteAction = localize('deleteAction', 'Delete');
|
||||
@@ -401,8 +432,7 @@ export const excludeAction = localize('excludeAction', 'Exclude');
|
||||
export const fileObject = localize('fileObject', "file");
|
||||
export const folderObject = localize('folderObject', "folder");
|
||||
|
||||
// Project script types
|
||||
|
||||
//#region Project script types
|
||||
export const folderFriendlyName = localize('folderFriendlyName', "Folder");
|
||||
export const scriptFriendlyName = localize('scriptFriendlyName', "Script");
|
||||
export const tableFriendlyName = localize('tableFriendlyName', "Table");
|
||||
@@ -415,18 +445,21 @@ export const externalStreamingJobFriendlyName = localize('externalStreamingJobFr
|
||||
export const preDeployScriptFriendlyName = localize('preDeployScriptFriendlyName', "Script.PreDeployment");
|
||||
export const postDeployScriptFriendlyName = localize('postDeployScriptFriendlyName', "Script.PostDeployment");
|
||||
|
||||
// Build
|
||||
//#endregion
|
||||
|
||||
//#region Build
|
||||
export const DotnetInstallationConfirmation: string = localize('sqlDatabaseProjects.DotnetInstallationConfirmation', "The .NET SDK cannot be located. Project build will not work. Please install .NET 6 SDK or higher or update the .NET SDK location in settings if already installed.");
|
||||
export function NetCoreSupportedVersionInstallationConfirmation(installedVersion: string) { return localize('sqlDatabaseProjects.NetCoreSupportedVersionInstallationConfirmation', "Currently installed .NET SDK version is {0}, which is not supported. Project build will not work. Please install .NET 6 SDK or higher or update the .NET SDK supported version location in settings if already installed.", installedVersion); }
|
||||
export const UpdateDotnetLocation: string = localize('sqlDatabaseProjects.UpdateDotnetLocation', "Update Location");
|
||||
export const projectsOutputChannel = localize('sqlDatabaseProjects.outputChannel', "Database Projects");
|
||||
|
||||
//#endregion
|
||||
|
||||
// Prompt buttons
|
||||
export const Install: string = localize('sqlDatabaseProjects.Install', "Install");
|
||||
export const DoNotAskAgain: string = localize('sqlDatabaseProjects.doNotAskAgain', "Don't Ask Again");
|
||||
|
||||
// SqlProj file XML names
|
||||
//#region SqlProj file XML names
|
||||
export const ItemGroup = 'ItemGroup';
|
||||
export const Build = 'Build';
|
||||
export const Folder = 'Folder';
|
||||
@@ -486,11 +519,9 @@ export const ProjectReferenceElement = localize('projectReferenceElement', "Proj
|
||||
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';
|
||||
//#endregion
|
||||
|
||||
|
||||
/** Default database collation to use when none is specified in the project */
|
||||
export const DefaultCollation = 'SQL_Latin1_General_CP1_CI_AS';
|
||||
|
||||
/**
|
||||
* Well-known database source values that are allowed to be sent in telemetry.
|
||||
@@ -500,34 +531,8 @@ export const DefaultCollation = 'SQL_Latin1_General_CP1_CI_AS';
|
||||
*/
|
||||
export const WellKnownDatabaseSources = ['dsct-oracle-to-ms-sql'];
|
||||
|
||||
// SqlProj File targets
|
||||
export const NetCoreTargets = '$(NETCoreTargetsPath)\\Microsoft.Data.Tools.Schema.SqlTasks.targets';
|
||||
export const SqlDbTargets = '$(SQLDBExtensionsRefPath)\\Microsoft.Data.Tools.Schema.SqlTasks.targets';
|
||||
export const MsBuildtargets = '$(MSBuildExtensionsPath)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\SSDT\\Microsoft.Data.Tools.Schema.SqlTasks.targets';
|
||||
export const NetCoreCondition = '\'$(NetCoreBuild)\' == \'true\'';
|
||||
export const NotNetCoreCondition = '\'$(NetCoreBuild)\' != \'true\'';
|
||||
export const SqlDbPresentCondition = '\'$(SQLDBExtensionsRefPath)\' != \'\'';
|
||||
export const SqlDbNotPresentCondition = '\'$(SQLDBExtensionsRefPath)\' == \'\'';
|
||||
export const RoundTripSqlDbPresentCondition = '\'$(NetCoreBuild)\' != \'true\' AND \'$(SQLDBExtensionsRefPath)\' != \'\'';
|
||||
export const RoundTripSqlDbNotPresentCondition = '\'$(NetCoreBuild)\' != \'true\' AND \'$(SQLDBExtensionsRefPath)\' == \'\'';
|
||||
export const DacpacRootPath = '$(DacPacRootPath)';
|
||||
export const ProjJsonToClean = '$(BaseIntermediateOutputPath)\\project.assets.json';
|
||||
export const EmptyConfigurationCondition = '\'$(Configuration)\' == \'\'';
|
||||
export const EmptyPlatformCondition = '\'$(Platform)\' == \'\'';
|
||||
export function ConfigurationPlatformCondition(configuration: string, platform: string) { return `'$(Configuration)|$(Platform)' == '${configuration}|${platform}'`; }
|
||||
|
||||
export function defaultOutputPath(configuration: string) { return path.join('.', 'bin', configuration); }
|
||||
|
||||
// Sqlproj VS property conditions
|
||||
export const VSVersionCondition = '\'$(VisualStudioVersion)\' == \'\'';
|
||||
export const SsdtExistsCondition = '\'$(SSDTExists)\' == \'\'';
|
||||
export const targetsExistsCondition = 'Exists(\'$(MSBuildExtensionsPath)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\SSDT\\Microsoft.Data.Tools.Schema.SqlTasks.targets\')';
|
||||
|
||||
// SqlProj Reference Assembly Information
|
||||
export const NETFrameworkAssembly = 'Microsoft.NETFramework.ReferenceAssemblies';
|
||||
export const VersionNumber = '1.0.0';
|
||||
export const All = 'All';
|
||||
|
||||
/**
|
||||
* Path separator to use within SqlProj file for `Include`, `Exclude`, etc. attributes.
|
||||
* This matches Windows path separator, as expected by SSDT.
|
||||
@@ -538,7 +543,7 @@ export const SqlProjPathSeparator = '\\';
|
||||
export const targetDatabaseName = 'TargetDatabaseName';
|
||||
export const targetConnectionString = 'TargetConnectionString';
|
||||
|
||||
// SQL connection string components
|
||||
//#region SQL connection string components
|
||||
export const initialCatalogSetting = 'Initial Catalog';
|
||||
export const dataSourceSetting = 'Data Source';
|
||||
export const integratedSecuritySetting = 'Integrated Security';
|
||||
@@ -551,8 +556,9 @@ export const trustServerCertificateSetting = 'Trust Server Certificate';
|
||||
export const hostnameInCertificateSetting = 'Host Name in Certificate';
|
||||
|
||||
export const azureAddAccount = localize('azureAddAccount', "Add an Account...");
|
||||
//#endregion
|
||||
|
||||
// Tree item types
|
||||
//#region Tree item types
|
||||
export enum DatabaseProjectItemType {
|
||||
project = 'databaseProject.itemType.project',
|
||||
legacyProject = 'databaseProject.itemType.legacyProject',
|
||||
@@ -572,7 +578,9 @@ export enum DatabaseProjectItemType {
|
||||
publishProfile = 'databaseProject.itemType.file.publishProfile'
|
||||
}
|
||||
|
||||
// AutoRest
|
||||
//#endregion
|
||||
|
||||
//#region AutoRest
|
||||
export const autorestPostDeploymentScriptName = 'PostDeploymentScript.sql';
|
||||
export const nodeButNotAutorestFound = localize('nodeButNotAutorestFound', "Autorest tool not found in system path, but found Node.js. Prompting user for how to proceed. Execute 'npm install autorest -g' to install permanently and avoid this message.");
|
||||
export const nodeNotFound = localize('nodeNotFound', "Neither Autorest nor Node.js (npx) found in system path. Please install Node.js for Autorest generation to work.");
|
||||
@@ -590,6 +598,7 @@ export function multipleMostDeploymentScripts(count: number) { return localize('
|
||||
export const specSelectionText = localize('specSelectionText', "OpenAPI/Swagger spec");
|
||||
export const autorestProjectName = localize('autorestProjectName', "New SQL project name");
|
||||
export function generatingProjectFromAutorest(specName: string) { return localize('generatingProjectFromAutorest', "Generating new SQL project from {0}... Check output window for details.", specName); }
|
||||
//#endregion
|
||||
|
||||
// System dbs
|
||||
export const systemDbs = ['master', 'msdb', 'tempdb', 'model'];
|
||||
@@ -598,8 +607,9 @@ export const systemDbs = ['master', 'msdb', 'tempdb', 'model'];
|
||||
export const sameDatabaseExampleUsage = 'SELECT * FROM [Schema1].[Table1]';
|
||||
export function differentDbSameServerExampleUsage(db: string) { return `SELECT * FROM [${db}].[Schema1].[Table1]`; }
|
||||
export function differentDbDifferentServerExampleUsage(server: string, db: string) { return `SELECT * FROM [${server}].[${db}].[Schema1].[Table1]`; }
|
||||
//#endregion
|
||||
|
||||
// Target platforms
|
||||
//#region Target platforms
|
||||
export const targetPlatformToVersion: Map<string, string> = new Map<string, string>([
|
||||
[SqlTargetPlatform.sqlServer2012, '110'],
|
||||
[SqlTargetPlatform.sqlServer2014, '120'],
|
||||
@@ -635,33 +645,44 @@ export function getTargetPlatformFromVersion(version: string): string {
|
||||
return Array.from(targetPlatformToVersion.keys()).filter(k => targetPlatformToVersion.get(k) === version)[0];
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
export enum PublishTargetType {
|
||||
existingServer = 'existingServer',
|
||||
docker = 'docker',
|
||||
newAzureServer = 'newAzureServer'
|
||||
}
|
||||
|
||||
// Configuration keys
|
||||
//#region Configuration keys
|
||||
export const CollapseProjectNodesKey = 'collapseProjectNodes';
|
||||
export const microsoftBuildSqlVersionKey = 'microsoftBuildSqlVersion';
|
||||
export const enablePreviewFeaturesKey = 'enablePreviewFeatures';
|
||||
|
||||
// httpClient
|
||||
//#endregion
|
||||
|
||||
//#region httpClient
|
||||
export const downloadError = localize('downloadError', "Download error");
|
||||
export const downloadProgress = localize('downloadProgress', "Download progress");
|
||||
export const downloading = localize('downloading', "Downloading");
|
||||
|
||||
// buildHelper
|
||||
//#endregion
|
||||
|
||||
//#region buildHelper
|
||||
export const downloadingDacFxDlls = localize('downloadingDacFxDlls', "Downloading Microsoft.Build.Sql nuget to get build DLLs");
|
||||
export function downloadingFromTo(from: string, to: string) { return localize('downloadingFromTo', "Downloading from {0} to {1}", from, to); }
|
||||
export function extractingDacFxDlls(location: string) { return localize('extractingDacFxDlls', "Extracting DacFx build DLLs to {0}", location); }
|
||||
export function errorDownloading(url: string, error: string) { return localize('errorDownloading', "Error downloading {0}. Error: {1}", url, error); }
|
||||
export function errorExtracting(path: string, error: string) { return localize('errorExtracting', "Error extracting files from {0}. Error: {1}", path, error); }
|
||||
|
||||
// move
|
||||
//#endregion
|
||||
|
||||
//#region move
|
||||
export const onlyMoveSqlFilesSupported = localize('onlyMoveSqlFilesSupported', "Only moving .sql files is supported");
|
||||
export const movingFilesBetweenProjectsNotSupported = localize('movingFilesBetweenProjectsNotSupported', "Moving files between projects is not supported");
|
||||
export function errorMovingFile(source: string, destination: string, error: string) { return localize('errorMovingFile', "Error when moving file from {0} to {1}. Error: {2}", source, destination, error); }
|
||||
export function moveConfirmationPrompt(source: string, destination: string) { return localize('moveConfirmationPrompt', "Are you sure you want to move {0} to {1}?", source, destination); }
|
||||
export const move = localize('Move', "Move");
|
||||
export function errorRenamingFile(source: string, destination: string, error: string) { return localize('errorRenamingFile', "Error when renaming file from {0} to {1}. Error: {2}", source, destination, error); }
|
||||
export const unhandledMoveNode = localize('unhandledMoveNode', "Unhandled node type for move");
|
||||
|
||||
//#endregion
|
||||
|
||||
@@ -34,9 +34,6 @@ export enum TelemetryActions {
|
||||
build = 'build',
|
||||
updateProjectForRoundtrip = 'updateProjectForRoundtrip',
|
||||
changePlatformType = 'changePlatformType',
|
||||
updateSystemDatabaseReferencesInProjFile = 'updateSystemDatabaseReferencesInProjFile',
|
||||
startAddSqlBinding = 'startAddSqlBinding',
|
||||
finishAddSqlBinding = 'finishAddSqlBinding',
|
||||
createProjectFromDatabase = 'createProjectFromDatabase',
|
||||
updateProjectFromDatabase = 'updateProjectFromDatabase',
|
||||
publishToContainer = 'publishToContainer',
|
||||
|
||||
@@ -152,6 +152,19 @@ export function convertSlashesForSqlProj(filePath: string): string {
|
||||
: filePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a SystemDatabase enum to its string value
|
||||
* @param systemDb
|
||||
* @returns
|
||||
*/
|
||||
export function systemDatabaseToString(systemDb: mssql.SystemDatabase): string {
|
||||
if (systemDb === mssql.SystemDatabase.Master) {
|
||||
return constants.master;
|
||||
} else {
|
||||
return constants.msdb;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read SQLCMD variables from xmlDoc and return them
|
||||
* @param xmlDoc xml doc to read SQLCMD variables from. Format must be the same that sqlproj and publish profiles use
|
||||
@@ -303,14 +316,15 @@ export async function getSchemaCompareService(): Promise<ISchemaCompareService>
|
||||
}
|
||||
}
|
||||
|
||||
export async function getSqlProjectsService(): Promise<ISqlProjectsService> {
|
||||
export async function getSqlProjectsService(): Promise<mssql.ISqlProjectsService> {
|
||||
if (getAzdataApi()) {
|
||||
const ext = vscode.extensions.getExtension(mssql.extension.name) as vscode.Extension<mssql.IExtension>;
|
||||
const api = await ext.activate();
|
||||
return api.sqlProjects;
|
||||
} else {
|
||||
const api = await getVscodeMssqlApi();
|
||||
return api.sqlProjects;
|
||||
throw new Error(constants.errorNotSupportedInVsCode('SqlProjectService'));
|
||||
// const api = await getVscodeMssqlApi();
|
||||
// return api.sqlProjects;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -785,3 +799,33 @@ export function isPublishProfile(fileName: string): boolean {
|
||||
const hasPublishExtension = fileName.trim().toLowerCase().endsWith(constants.publishProfileExtension);
|
||||
return hasPublishExtension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if a file exists at absoluteFilePath, and writes contents if it doesn't.
|
||||
* If either the file already exists and contents is specified or the file doesn't exist and contents is blank,
|
||||
* then an exception is thrown.
|
||||
* @param absoluteFilePath
|
||||
* @param contents
|
||||
*/
|
||||
export async function ensureFileExists(absoluteFilePath: string, contents?: string): Promise<void> {
|
||||
if (contents) {
|
||||
// Create the file if contents were passed in and file does not exist yet
|
||||
await fs.mkdir(path.dirname(absoluteFilePath), { recursive: true });
|
||||
|
||||
try {
|
||||
await fs.writeFile(absoluteFilePath, contents, { flag: 'wx' });
|
||||
} catch (error) {
|
||||
if (error.code === 'EEXIST') {
|
||||
// Throw specialized error, if file already exists
|
||||
throw new Error(constants.fileAlreadyExists(path.parse(absoluteFilePath).name));
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
} else {
|
||||
// If no contents were provided, then check that file already exists
|
||||
if (!await exists(absoluteFilePath)) {
|
||||
throw new Error(constants.noFileExist(absoluteFilePath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user