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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,6 @@ export default class MainController implements vscode.Disposable {
|
||||
this.context.subscriptions.push(vscode.commands.registerCommand('sqlDatabaseProjects.addDatabaseReference', async (node: WorkspaceTreeItem) => { return this.projectsController.addDatabaseReference(node); }));
|
||||
this.context.subscriptions.push(vscode.commands.registerCommand('sqlDatabaseProjects.openContainingFolder', async (node: WorkspaceTreeItem) => { return this.projectsController.openContainingFolder(node); }));
|
||||
this.context.subscriptions.push(vscode.commands.registerCommand('sqlDatabaseProjects.editProjectFile', async (node: WorkspaceTreeItem) => { return this.projectsController.editProjectFile(node); }));
|
||||
this.context.subscriptions.push(vscode.commands.registerCommand('sqlDatabaseProjects.convertToSdkStyleProject', async (node: WorkspaceTreeItem) => { return this.projectsController.convertToSdkStyleProject(node); }));
|
||||
this.context.subscriptions.push(vscode.commands.registerCommand('sqlDatabaseProjects.delete', async (node: WorkspaceTreeItem) => { return this.projectsController.delete(node); }));
|
||||
this.context.subscriptions.push(vscode.commands.registerCommand('sqlDatabaseProjects.exclude', async (node: WorkspaceTreeItem) => { return this.projectsController.exclude(node); }));
|
||||
this.context.subscriptions.push(vscode.commands.registerCommand('sqlDatabaseProjects.rename', async (node: WorkspaceTreeItem) => { return this.projectsController.rename(node); }));
|
||||
|
||||
@@ -17,9 +17,9 @@ import * as mssqlVscode from 'vscode-mssql';
|
||||
|
||||
import { promises as fs } from 'fs';
|
||||
import { PublishDatabaseDialog } from '../dialogs/publishDatabaseDialog';
|
||||
import { Project, reservedProjectFolders } from '../models/project';
|
||||
import { Project } from '../models/project';
|
||||
import { SqlDatabaseProjectTreeViewProvider } from './databaseProjectTreeViewProvider';
|
||||
import { FolderNode, FileNode, SqlObjectFileNode, PreDeployNode, PostDeployNode } from '../models/tree/fileFolderTreeItem';
|
||||
import { FolderNode, FileNode } from '../models/tree/fileFolderTreeItem';
|
||||
import { BaseProjectTreeItem } from '../models/tree/baseTreeItem';
|
||||
import { ImportDataModel } from '../models/api/import';
|
||||
import { NetCoreTool, DotNetError } from '../tools/netcoreTool';
|
||||
@@ -201,8 +201,9 @@ export class ProjectsController {
|
||||
const projectStyle = creationParams.sdkStyle ? mssql.ProjectType.SdkStyle : mssql.ProjectType.LegacyStyle;
|
||||
await (sqlProjectsService as mssql.ISqlProjectsService).createProject(newProjFilePath, projectStyle, targetPlatform);
|
||||
} else {
|
||||
const projectStyle = creationParams.sdkStyle ? mssqlVscode.ProjectType.SdkStyle : mssqlVscode.ProjectType.LegacyStyle;
|
||||
await (sqlProjectsService as mssqlVscode.ISqlProjectsService).createProject(newProjFilePath, projectStyle, targetPlatform);
|
||||
throw new Error(constants.errorNotSupportedInVsCode('createProject'));
|
||||
//const projectStyle = creationParams.sdkStyle ? mssqlVscode.ProjectType.SdkStyle : mssqlVscode.ProjectType.LegacyStyle;
|
||||
//await (sqlProjectsService as mssqlVscode.ISqlProjectsService).createProject(newProjFilePath, projectStyle, targetPlatform);
|
||||
}
|
||||
|
||||
await this.addTemplateFiles(newProjFilePath, creationParams.projectTypeId);
|
||||
@@ -223,19 +224,34 @@ export class ProjectsController {
|
||||
if (projectTypeId === constants.edgeSqlDatabaseProjectTypeId) {
|
||||
const project = await Project.openProject(newProjFilePath);
|
||||
|
||||
await this.createFileFromTemplate(project, templates.get(ItemType.table), 'DataTable.sql', { 'OBJECT_NAME': 'DataTable' });
|
||||
await this.createFileFromTemplate(project, templates.get(ItemType.dataSource), 'EdgeHubInputDataSource.sql', { 'OBJECT_NAME': 'EdgeHubInputDataSource', 'LOCATION': 'edgehub://' });
|
||||
await this.createFileFromTemplate(project, templates.get(ItemType.dataSource), 'SqlOutputDataSource.sql', { 'OBJECT_NAME': 'SqlOutputDataSource', 'LOCATION': 'sqlserver://tcp:.,1433' });
|
||||
await this.createFileFromTemplate(project, templates.get(ItemType.fileFormat), 'StreamFileFormat.sql', { 'OBJECT_NAME': 'StreamFileFormat' });
|
||||
await this.createFileFromTemplate(project, templates.get(ItemType.externalStream), 'EdgeHubInputStream.sql', { 'OBJECT_NAME': 'EdgeHubInputStream', 'DATA_SOURCE_NAME': 'EdgeHubInputDataSource', 'LOCATION': 'input', 'OPTIONS': ',\n\tFILE_FORMAT = StreamFileFormat' });
|
||||
await this.createFileFromTemplate(project, templates.get(ItemType.externalStream), 'SqlOutputStream.sql', { 'OBJECT_NAME': 'SqlOutputStream', 'DATA_SOURCE_NAME': 'SqlOutputDataSource', 'LOCATION': 'TSQLStreaming.dbo.DataTable', 'OPTIONS': '' });
|
||||
await this.createFileFromTemplate(project, templates.get(ItemType.externalStreamingJob), 'EdgeStreamingJob.sql', { 'OBJECT_NAME': 'EdgeStreamingJob' });
|
||||
await this.addFileToProjectFromTemplate(project, templates.get(ItemType.table), 'DataTable.sql', { 'OBJECT_NAME': 'DataTable' });
|
||||
await this.addFileToProjectFromTemplate(project, templates.get(ItemType.dataSource), 'EdgeHubInputDataSource.sql', { 'OBJECT_NAME': 'EdgeHubInputDataSource', 'LOCATION': 'edgehub://' });
|
||||
await this.addFileToProjectFromTemplate(project, templates.get(ItemType.dataSource), 'SqlOutputDataSource.sql', { 'OBJECT_NAME': 'SqlOutputDataSource', 'LOCATION': 'sqlserver://tcp:.,1433' });
|
||||
await this.addFileToProjectFromTemplate(project, templates.get(ItemType.fileFormat), 'StreamFileFormat.sql', { 'OBJECT_NAME': 'StreamFileFormat' });
|
||||
await this.addFileToProjectFromTemplate(project, templates.get(ItemType.externalStream), 'EdgeHubInputStream.sql', { 'OBJECT_NAME': 'EdgeHubInputStream', 'DATA_SOURCE_NAME': 'EdgeHubInputDataSource', 'LOCATION': 'input', 'OPTIONS': ',\n\tFILE_FORMAT = StreamFileFormat' });
|
||||
await this.addFileToProjectFromTemplate(project, templates.get(ItemType.externalStream), 'SqlOutputStream.sql', { 'OBJECT_NAME': 'SqlOutputStream', 'DATA_SOURCE_NAME': 'SqlOutputDataSource', 'LOCATION': 'TSQLStreaming.dbo.DataTable', 'OPTIONS': '' });
|
||||
await this.addFileToProjectFromTemplate(project, templates.get(ItemType.externalStreamingJob), 'EdgeStreamingJob.sql', { 'OBJECT_NAME': 'EdgeStreamingJob' });
|
||||
}
|
||||
}
|
||||
|
||||
private async createFileFromTemplate(project: Project, itemType: templates.ProjectScriptType, relativePath: string, expansionMacros: Record<string, string>): Promise<void> {
|
||||
private async addFileToProjectFromTemplate(project: ISqlProject, itemType: templates.ProjectScriptType, relativePath: string, expansionMacros: Record<string, string>): Promise<string> {
|
||||
const newFileText = templates.macroExpansion(itemType.templateScript, expansionMacros);
|
||||
await project.addScriptItem(relativePath, newFileText, itemType.type);
|
||||
const absolutePath = path.join(project.projectFolderPath, relativePath)
|
||||
await utils.ensureFileExists(absolutePath, newFileText);
|
||||
|
||||
switch (itemType.type) {
|
||||
case ItemType.preDeployScript:
|
||||
await project.addPreDeploymentScript(relativePath);
|
||||
break;
|
||||
case ItemType.postDeployScript:
|
||||
await project.addPostDeploymentScript(relativePath);
|
||||
break;
|
||||
default: // a normal SQL object script
|
||||
await project.addSqlObjectScript(relativePath);
|
||||
break;
|
||||
}
|
||||
|
||||
return absolutePath;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
@@ -266,7 +282,7 @@ export class ProjectsController {
|
||||
}
|
||||
|
||||
// get dlls and targets file needed for building for legacy style projects
|
||||
if (!project.isSdkStyleProject) {
|
||||
if (project.sqlProjStyle === mssql.ProjectType.LegacyStyle) {
|
||||
const result = await this.buildHelper.createBuildDirFolder(this._outputChannel);
|
||||
|
||||
if (!result) {
|
||||
@@ -278,7 +294,7 @@ export class ProjectsController {
|
||||
const options: ShellCommandOptions = {
|
||||
commandTitle: 'Build',
|
||||
workingDirectory: project.projectFolderPath,
|
||||
argument: this.buildHelper.constructBuildArguments(project.projectFilePath, this.buildHelper.extensionBuildDirPath, project.isSdkStyleProject)
|
||||
argument: this.buildHelper.constructBuildArguments(project.projectFilePath, this.buildHelper.extensionBuildDirPath, project.sqlProjStyle)
|
||||
};
|
||||
|
||||
try {
|
||||
@@ -640,7 +656,7 @@ export class ProjectsController {
|
||||
throw new Error(constants.folderAlreadyExists(path.parse(absoluteFolderPath).name));
|
||||
}
|
||||
|
||||
await project.addFolderItem(relativeFolderPath);
|
||||
await project.addFolder(relativeFolderPath);
|
||||
this.refreshProjectsTree(treeNode);
|
||||
} catch (err) {
|
||||
void vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
||||
@@ -669,7 +685,7 @@ export class ProjectsController {
|
||||
}
|
||||
|
||||
public isReservedFolder(absoluteFolderPath: string, projectFolderPath: string): boolean {
|
||||
const sameName = reservedProjectFolders.find(f => f === path.parse(absoluteFolderPath).name) !== undefined;
|
||||
const sameName = constants.reservedProjectFolders.find(f => f === path.parse(absoluteFolderPath).name) !== undefined;
|
||||
const sameLocation = path.parse(absoluteFolderPath).dir === projectFolderPath;
|
||||
return sameName && sameLocation;
|
||||
}
|
||||
@@ -707,7 +723,6 @@ export class ProjectsController {
|
||||
return; // user cancelled
|
||||
}
|
||||
|
||||
const newFileText = templates.macroExpansion(itemType.templateScript, { 'OBJECT_NAME': itemObjectName });
|
||||
const relativeFilePath = path.join(relativePath, itemObjectName + constants.sqlFileExtension);
|
||||
|
||||
const telemetryProps: Record<string, string> = { itemType: itemType.type };
|
||||
@@ -720,14 +735,14 @@ export class ProjectsController {
|
||||
}
|
||||
|
||||
try {
|
||||
const newEntry = await project.addScriptItem(relativeFilePath, newFileText, itemType.type);
|
||||
const absolutePath = await this.addFileToProjectFromTemplate(project, itemType, relativeFilePath, { 'OBJECT_NAME': itemObjectName });
|
||||
|
||||
TelemetryReporter.createActionEvent(TelemetryViews.ProjectTree, TelemetryActions.addItemFromTree)
|
||||
.withAdditionalProperties(telemetryProps)
|
||||
.withAdditionalMeasurements(telemetryMeasurements)
|
||||
.send();
|
||||
|
||||
await vscode.commands.executeCommand(constants.vscodeOpenCommand, newEntry.fsUri);
|
||||
await vscode.commands.executeCommand(constants.vscodeOpenCommand, vscode.Uri.file(absolutePath));
|
||||
treeDataProvider?.notifyTreeDataChanged();
|
||||
} catch (err) {
|
||||
void vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
||||
@@ -772,7 +787,30 @@ export class ProjectsController {
|
||||
|
||||
if (fileEntry) {
|
||||
TelemetryReporter.sendActionEvent(TelemetryViews.ProjectTree, TelemetryActions.excludeFromProject);
|
||||
await project.exclude(fileEntry);
|
||||
|
||||
switch (node.type) {
|
||||
case constants.DatabaseProjectItemType.sqlObjectScript:
|
||||
case constants.DatabaseProjectItemType.table:
|
||||
case constants.DatabaseProjectItemType.externalStreamingJob:
|
||||
await project.excludeSqlObjectScript(fileEntry.relativePath);
|
||||
break;
|
||||
case constants.DatabaseProjectItemType.folder:
|
||||
// TODO: not yet supported in DacFx
|
||||
//await project.excludeFolder(fileEntry.relativePath);
|
||||
void vscode.window.showErrorMessage(constants.excludeFolderNotSupported);
|
||||
break;
|
||||
case constants.DatabaseProjectItemType.preDeploymentScript:
|
||||
await project.excludePreDeploymentScript(fileEntry.relativePath);
|
||||
break;
|
||||
case constants.DatabaseProjectItemType.postDeploymentScript:
|
||||
await project.excludePostDeploymentScript(fileEntry.relativePath);
|
||||
break;
|
||||
case constants.DatabaseProjectItemType.noneFile:
|
||||
await project.excludeNoneItem(fileEntry.relativePath);
|
||||
break;
|
||||
default:
|
||||
throw new Error(constants.unhandledExcludeType(node.type));
|
||||
}
|
||||
} else {
|
||||
TelemetryReporter.sendErrorEvent2(TelemetryViews.ProjectTree, TelemetryActions.excludeFromProject);
|
||||
void vscode.window.showErrorMessage(constants.unableToPerformAction(constants.excludeAction, node.relativeProjectUri.path));
|
||||
@@ -802,35 +840,43 @@ export class ProjectsController {
|
||||
return;
|
||||
}
|
||||
|
||||
let success = false;
|
||||
try {
|
||||
if (node instanceof DatabaseReferenceTreeItem) {
|
||||
const databaseReference = this.getDatabaseReference(project, node);
|
||||
|
||||
if (node instanceof DatabaseReferenceTreeItem) {
|
||||
const databaseReference = this.getDatabaseReference(project, node);
|
||||
|
||||
if (databaseReference) {
|
||||
await project.deleteDatabaseReference(databaseReference);
|
||||
success = true;
|
||||
if (databaseReference) {
|
||||
await project.deleteDatabaseReferenceByEntry(databaseReference);
|
||||
}
|
||||
} else if (node instanceof SqlCmdVariableTreeItem) {
|
||||
await project.deleteSqlCmdVariable(node.friendlyName);
|
||||
} else if (node instanceof FolderNode) {
|
||||
await project.deleteFolder(node.entryKey);
|
||||
} else if (node instanceof FileNode) {
|
||||
switch (node.type) {
|
||||
case constants.DatabaseProjectItemType.sqlObjectScript:
|
||||
case constants.DatabaseProjectItemType.table:
|
||||
case constants.DatabaseProjectItemType.externalStreamingJob:
|
||||
await project.deleteSqlObjectScript(node.entryKey);
|
||||
break;
|
||||
case constants.DatabaseProjectItemType.preDeploymentScript:
|
||||
await project.deletePreDeploymentScript(node.entryKey);
|
||||
break;
|
||||
case constants.DatabaseProjectItemType.postDeploymentScript:
|
||||
await project.deletePostDeploymentScript(node.entryKey);
|
||||
break;
|
||||
case constants.DatabaseProjectItemType.noneFile:
|
||||
await project.deleteNoneItem(node.entryKey);
|
||||
break;
|
||||
default:
|
||||
throw new Error(constants.unhandledDeleteType(node.type));
|
||||
}
|
||||
}
|
||||
} else if (node instanceof SqlCmdVariableTreeItem) {
|
||||
const sqlProjectsService = await utils.getSqlProjectsService();
|
||||
const result = await sqlProjectsService.deleteSqlCmdVariable(project.projectFilePath, node.friendlyName);
|
||||
success = result.success;
|
||||
} else if (node instanceof FileNode || FolderNode) {
|
||||
const fileEntry = this.getFileProjectEntry(project, node);
|
||||
|
||||
if (fileEntry) {
|
||||
await project.deleteFileFolder(fileEntry);
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (success) {
|
||||
TelemetryReporter.createActionEvent(TelemetryViews.ProjectTree, TelemetryActions.deleteObjectFromProject)
|
||||
.withAdditionalProperties({ objectType: node.constructor.name })
|
||||
.send();
|
||||
|
||||
this.refreshProjectsTree(context);
|
||||
} else {
|
||||
} catch {
|
||||
TelemetryReporter.createErrorEvent2(TelemetryViews.ProjectTree, TelemetryActions.deleteObjectFromProject)
|
||||
.withAdditionalProperties({ objectType: node.constructor.name })
|
||||
.send();
|
||||
@@ -862,7 +908,7 @@ export class ProjectsController {
|
||||
|
||||
const newFilePath = path.join(path.dirname(utils.getPlatformSafeFileEntryPath(file?.relativePath!)), `${newFileName}.sql`);
|
||||
|
||||
const renameResult = await this.move(node, node.projectFileUri.fsPath, newFilePath);
|
||||
const renameResult = await project.move(node, newFilePath);
|
||||
|
||||
if (renameResult?.success) {
|
||||
TelemetryReporter.sendActionEvent(TelemetryViews.ProjectTree, TelemetryActions.rename);
|
||||
@@ -885,11 +931,12 @@ export class ProjectsController {
|
||||
public async editSqlCmdVariable(context: dataworkspace.WorkspaceTreeItem): Promise<void> {
|
||||
const node = context.element as SqlCmdVariableTreeItem;
|
||||
const project = await this.getProjectFromContext(node);
|
||||
const originalValue = project.sqlCmdVariables[node.friendlyName]; // TODO: update to hookup with however sqlcmd vars work after swap
|
||||
const variableName = node.friendlyName;
|
||||
const originalValue = project.sqlCmdVariables[variableName];
|
||||
|
||||
const newValue = await vscode.window.showInputBox(
|
||||
{
|
||||
title: constants.enterNewValueForVar(node.friendlyName),
|
||||
title: constants.enterNewValueForVar(variableName),
|
||||
value: originalValue,
|
||||
ignoreFocusOut: true
|
||||
});
|
||||
@@ -898,7 +945,8 @@ export class ProjectsController {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: update value in sqlcmd variables after swap
|
||||
await project.updateSqlCmdVariable(variableName, newValue)
|
||||
this.refreshProjectsTree(context);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -931,9 +979,7 @@ export class ProjectsController {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: update after swap
|
||||
await project.addSqlCmdVariable(variableName, defaultValue);
|
||||
|
||||
this.refreshProjectsTree(context);
|
||||
}
|
||||
|
||||
@@ -945,7 +991,7 @@ export class ProjectsController {
|
||||
const databaseReference = context as DatabaseReferenceTreeItem;
|
||||
|
||||
if (databaseReference) {
|
||||
return project.databaseReferences.find(r => r.databaseName === databaseReference.treeItem.label);
|
||||
return project.databaseReferences.find(r => r.referenceName === databaseReference.treeItem.label);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
@@ -1068,35 +1114,6 @@ export class ProjectsController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a legacy style project to an SDK-style project
|
||||
* @param context a treeItem in a project's hierarchy, to be used to obtain a Project
|
||||
*/
|
||||
public async convertToSdkStyleProject(context: dataworkspace.WorkspaceTreeItem): Promise<void> {
|
||||
const project = await this.getProjectFromContext(context);
|
||||
|
||||
// confirm that user wants to update the project and knows the SSDT doesn't have support for displaying glob files yet
|
||||
await vscode.window.showWarningMessage(constants.convertToSdkStyleConfirmation(project.projectFileName), { modal: true }, constants.yesString).then(async (result) => {
|
||||
if (result === constants.yesString) {
|
||||
const updateResult = await project.convertProjectToSdkStyle();
|
||||
void this.reloadProject(context);
|
||||
|
||||
if (!updateResult) {
|
||||
void vscode.window.showErrorMessage(constants.updatedToSdkStyleError(project.projectFileName));
|
||||
} else {
|
||||
void this.reloadProject(context);
|
||||
|
||||
// show message that project file can be simplified
|
||||
const result = await vscode.window.showInformationMessage(constants.projectUpdatedToSdkStyle(project.projectFileName), constants.learnMore);
|
||||
|
||||
if (result === constants.learnMore) {
|
||||
void vscode.env.openExternal(vscode.Uri.parse(constants.sdkLearnMoreUrl!));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//#region database references
|
||||
|
||||
/**
|
||||
@@ -1367,9 +1384,9 @@ export class ProjectsController {
|
||||
return;
|
||||
}
|
||||
|
||||
const fileFolderList: vscode.Uri[] | undefined = await this.getSqlFileList(projectInfo.newProjectFolder);
|
||||
const scriptList: vscode.Uri[] | undefined = await this.getSqlFileList(projectInfo.newProjectFolder);
|
||||
|
||||
if (!fileFolderList || fileFolderList.length === 0) {
|
||||
if (!scriptList || scriptList.length === 0) {
|
||||
void vscode.window.showInformationMessage(constants.noSqlFilesGenerated);
|
||||
this._outputChannel.show();
|
||||
return;
|
||||
@@ -1386,12 +1403,15 @@ export class ProjectsController {
|
||||
const project = await Project.openProject(newProjFilePath);
|
||||
|
||||
// 6. add generated files to SQL project
|
||||
await project.addToProject(fileFolderList.filter(f => !f.fsPath.endsWith(constants.autorestPostDeploymentScriptName))); // Add generated file structure to the project
|
||||
|
||||
const postDeploymentScript: vscode.Uri | undefined = this.findPostDeploymentScript(fileFolderList);
|
||||
const uriList = scriptList.filter(f => !f.fsPath.endsWith(constants.autorestPostDeploymentScriptName))
|
||||
const relativePaths = uriList.map(f => path.relative(project.projectFolderPath, f.path));
|
||||
await project.addSqlObjectScripts(relativePaths); // Add generated file structure to the project
|
||||
|
||||
const postDeploymentScript: vscode.Uri | undefined = this.findPostDeploymentScript(scriptList);
|
||||
|
||||
if (postDeploymentScript) {
|
||||
await project.addScriptItem(path.relative(project.projectFolderPath, postDeploymentScript.fsPath), undefined, ItemType.postDeployScript);
|
||||
await project.addPostDeploymentScript(path.relative(project.projectFolderPath, postDeploymentScript.fsPath));
|
||||
}
|
||||
|
||||
if (options?.doNotOpenInWorkspace !== true) {
|
||||
@@ -1576,10 +1596,12 @@ export class ProjectsController {
|
||||
.withAdditionalMeasurements({ durationMs: timeToExtract })
|
||||
.send();
|
||||
|
||||
let fileFolderList: vscode.Uri[] = model.extractTarget === mssql.ExtractTarget.file ? [vscode.Uri.file(model.filePath)] : await this.generateList(model.filePath); // Create a list of all the files and directories to be added to project
|
||||
const scriptList: vscode.Uri[] = model.extractTarget === mssql.ExtractTarget.file ? [vscode.Uri.file(model.filePath)] : await this.generateScriptList(model.filePath); // Create a list of all the files to be added to project
|
||||
|
||||
const relativePaths = scriptList.map(f => path.relative(project.projectFolderPath, f.path));
|
||||
|
||||
if (!model.sdkStyle) {
|
||||
await project.addToProject(fileFolderList); // Add generated file structure to the project
|
||||
await project.addSqlObjectScripts(relativePaths); // Add generated file structure to the project
|
||||
}
|
||||
|
||||
// add project to workspace
|
||||
@@ -1611,19 +1633,19 @@ export class ProjectsController {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a flat list of all files and folder under a folder.
|
||||
* Generate a flat list of all scripts under a folder.
|
||||
* @param absolutePath absolute path to folder to generate the list of files from
|
||||
* @returns array of uris of files and folders under the provided folder
|
||||
* @returns array of uris of files under the provided folder
|
||||
*/
|
||||
public async generateList(absolutePath: string): Promise<vscode.Uri[]> {
|
||||
let fileFolderList: vscode.Uri[] = [];
|
||||
public async generateScriptList(absolutePath: string): Promise<vscode.Uri[]> {
|
||||
let fileList: vscode.Uri[] = [];
|
||||
|
||||
if (!await utils.exists(absolutePath)) {
|
||||
if (await utils.exists(absolutePath + constants.sqlFileExtension)) {
|
||||
absolutePath += constants.sqlFileExtension;
|
||||
} else {
|
||||
void vscode.window.showErrorMessage(constants.cannotResolvePath(absolutePath));
|
||||
return fileFolderList;
|
||||
return fileList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1635,19 +1657,18 @@ export class ProjectsController {
|
||||
const stat = await fs.stat(filepath);
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
fileFolderList.push(vscode.Uri.file(filepath));
|
||||
(await fs
|
||||
.readdir(filepath))
|
||||
.forEach((f: string) => files.push(path.join(filepath, f)));
|
||||
}
|
||||
else if (stat.isFile()) {
|
||||
fileFolderList.push(vscode.Uri.file(filepath));
|
||||
else if (stat.isFile() && path.extname(filepath) === constants.sqlFileExtension) {
|
||||
fileList.push(vscode.Uri.file(filepath));
|
||||
}
|
||||
}
|
||||
|
||||
} while (files.length !== 0);
|
||||
|
||||
return fileFolderList;
|
||||
return fileList;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
@@ -1817,7 +1838,9 @@ export class ProjectsController {
|
||||
|
||||
let toAdd: vscode.Uri[] = [];
|
||||
result.addedFiles.forEach((f: any) => toAdd.push(vscode.Uri.file(f)));
|
||||
await project.addToProject(toAdd);
|
||||
const relativePaths = toAdd.map(f => path.relative(project.projectFolderPath, f.path));
|
||||
|
||||
await project.addSqlObjectScripts(relativePaths);
|
||||
|
||||
let toRemove: vscode.Uri[] = [];
|
||||
result.deletedFiles.forEach((f: any) => toRemove.push(vscode.Uri.file(f)));
|
||||
@@ -1825,7 +1848,7 @@ export class ProjectsController {
|
||||
let toRemoveEntries: FileProjectEntry[] = [];
|
||||
toRemove.forEach(f => toRemoveEntries.push(new FileProjectEntry(f, f.path.replace(projectPath + '\\', ''), EntryType.File)));
|
||||
|
||||
toRemoveEntries.forEach(async f => await project.exclude(f));
|
||||
toRemoveEntries.forEach(async f => await project.excludeSqlObjectScript(f.fsUri.fsPath));
|
||||
|
||||
await this.buildProject(project);
|
||||
}
|
||||
@@ -1843,6 +1866,7 @@ export class ProjectsController {
|
||||
*/
|
||||
public async moveFile(projectUri: vscode.Uri, source: any, target: dataworkspace.WorkspaceTreeItem): Promise<void> {
|
||||
const sourceFileNode = source as FileNode;
|
||||
const project = await this.getProjectFromContext(sourceFileNode);
|
||||
|
||||
// only moving files is supported
|
||||
if (!sourceFileNode || !(sourceFileNode instanceof FileNode)) {
|
||||
@@ -1885,7 +1909,7 @@ export class ProjectsController {
|
||||
}
|
||||
|
||||
// Move the file
|
||||
const moveResult = await this.move(sourceFileNode, projectUri.fsPath, newPath);
|
||||
const moveResult = await project.move(sourceFileNode, newPath);
|
||||
|
||||
if (moveResult?.success) {
|
||||
TelemetryReporter.sendActionEvent(TelemetryViews.ProjectTree, TelemetryActions.move);
|
||||
@@ -1894,38 +1918,6 @@ export class ProjectsController {
|
||||
void vscode.window.showErrorMessage(constants.errorMovingFile(sourceFileNode.fileSystemUri.fsPath, newPath, utils.getErrorMessage(moveResult?.errorMessage)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves a file to a different location
|
||||
* @param node Node being moved
|
||||
* @param projectFilePath Full file path to .sqlproj
|
||||
* @param destinationRelativePath path of the destination, relative to .sqlproj
|
||||
*/
|
||||
private async move(node: BaseProjectTreeItem, projectFilePath: string, destinationRelativePath: string): Promise<azdataType.ResultStatus | undefined> {
|
||||
// trim off the project folder at the beginning of the relative path stored in the tree
|
||||
const projectRelativeUri = vscode.Uri.file(path.basename(projectFilePath, constants.sqlprojExtension));
|
||||
const originalRelativePath = utils.trimUri(projectRelativeUri, node.relativeProjectUri);
|
||||
destinationRelativePath = utils.trimUri(projectRelativeUri, vscode.Uri.file(destinationRelativePath));
|
||||
|
||||
if (originalRelativePath === destinationRelativePath) {
|
||||
return;
|
||||
}
|
||||
|
||||
const sqlProjectsService = await utils.getSqlProjectsService();
|
||||
|
||||
let result;
|
||||
if (node instanceof SqlObjectFileNode) {
|
||||
result = await sqlProjectsService.moveSqlObjectScript(projectFilePath, destinationRelativePath, originalRelativePath)
|
||||
} else if (node instanceof PreDeployNode) {
|
||||
result = await sqlProjectsService.movePreDeploymentScript(projectFilePath, destinationRelativePath, originalRelativePath)
|
||||
} else if (node instanceof PostDeployNode) {
|
||||
result = await sqlProjectsService.movePostDeploymentScript(projectFilePath, destinationRelativePath, originalRelativePath)
|
||||
}
|
||||
// TODO add support for renaming none scripts after those are added in STS
|
||||
// TODO add support for renaming publish profiles when support is added in DacFx
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
export interface NewProjectParams {
|
||||
|
||||
@@ -15,7 +15,8 @@ import { IconPathHelper } from '../common/iconHelper';
|
||||
import { ISystemDatabaseReferenceSettings, IDacpacReferenceSettings, IProjectReferenceSettings } from '../models/IDatabaseReferenceSettings';
|
||||
import { Deferred } from '../common/promise';
|
||||
import { TelemetryActions, TelemetryReporter, TelemetryViews } from '../common/telemetry';
|
||||
import { SystemDatabase } from '../models/projectEntry';
|
||||
import { SystemDatabase } from 'mssql';
|
||||
import { DbServerValues, ensureSetOrDefined, populateResultWithVars } from './utils';
|
||||
|
||||
export enum ReferenceType {
|
||||
project,
|
||||
@@ -151,32 +152,42 @@ export class AddDatabaseReferenceDialog {
|
||||
public async addReferenceClick(): Promise<void> {
|
||||
let referenceSettings: ISystemDatabaseReferenceSettings | IDacpacReferenceSettings | IProjectReferenceSettings;
|
||||
|
||||
if (this.currentReferenceType === ReferenceType.project) {
|
||||
referenceSettings = {
|
||||
projectName: <string>this.projectDropdown?.value,
|
||||
projectGuid: '',
|
||||
projectRelativePath: undefined,
|
||||
databaseName: <string>this.databaseNameTextbox?.value,
|
||||
databaseVariable: <string>this.databaseVariableTextbox?.value,
|
||||
serverName: <string>this.serverNameTextbox?.value,
|
||||
serverVariable: <string>this.serverVariableTextbox?.value,
|
||||
suppressMissingDependenciesErrors: <boolean>this.suppressMissingDependenciesErrorsCheckbox?.checked
|
||||
};
|
||||
} else if (this.currentReferenceType === ReferenceType.systemDb) {
|
||||
referenceSettings = {
|
||||
databaseName: <string>this.databaseNameTextbox?.value,
|
||||
if (this.currentReferenceType === ReferenceType.systemDb) {
|
||||
const systemDbRef: ISystemDatabaseReferenceSettings = {
|
||||
databaseVariableLiteralValue: <string>this.databaseNameTextbox?.value,
|
||||
systemDb: getSystemDatabase(<string>this.systemDatabaseDropdown?.value),
|
||||
suppressMissingDependenciesErrors: <boolean>this.suppressMissingDependenciesErrorsCheckbox?.checked
|
||||
};
|
||||
} else { // this.currentReferenceType === ReferenceType.dacpac
|
||||
referenceSettings = {
|
||||
databaseName: <string>this.databaseNameTextbox?.value,
|
||||
dacpacFileLocation: vscode.Uri.file(<string>this.dacpacTextbox?.value),
|
||||
databaseVariable: utils.removeSqlCmdVariableFormatting(<string>this.databaseVariableTextbox?.value),
|
||||
serverName: <string>this.serverNameTextbox?.value,
|
||||
serverVariable: utils.removeSqlCmdVariableFormatting(<string>this.serverVariableTextbox?.value),
|
||||
suppressMissingDependenciesErrors: <boolean>this.suppressMissingDependenciesErrorsCheckbox?.checked
|
||||
|
||||
referenceSettings = systemDbRef;
|
||||
} else {
|
||||
if (this.currentReferenceType === ReferenceType.project) {
|
||||
const projRef: IProjectReferenceSettings = {
|
||||
projectName: <string>this.projectDropdown?.value,
|
||||
projectGuid: '',
|
||||
projectRelativePath: undefined,
|
||||
suppressMissingDependenciesErrors: <boolean>this.suppressMissingDependenciesErrorsCheckbox?.checked
|
||||
};
|
||||
|
||||
referenceSettings = projRef;
|
||||
} else { // this.currentReferenceType === ReferenceType.dacpac
|
||||
const dacpacRef: IDacpacReferenceSettings = {
|
||||
databaseName: ensureSetOrDefined(this.databaseNameTextbox?.value),
|
||||
dacpacFileLocation: vscode.Uri.file(<string>this.dacpacTextbox?.value),
|
||||
suppressMissingDependenciesErrors: <boolean>this.suppressMissingDependenciesErrorsCheckbox?.checked
|
||||
};
|
||||
|
||||
referenceSettings = dacpacRef;
|
||||
}
|
||||
|
||||
const dbServerValues: DbServerValues = {
|
||||
dbName: this.databaseNameTextbox?.value,
|
||||
dbVariable: this.databaseVariableTextbox?.value,
|
||||
serverName: this.serverNameTextbox?.value,
|
||||
serverVariable: this.serverVariableTextbox?.value
|
||||
};
|
||||
|
||||
populateResultWithVars(referenceSettings, dbServerValues);
|
||||
}
|
||||
|
||||
TelemetryReporter.createActionEvent(TelemetryViews.ProjectTree, TelemetryActions.addDatabaseReference)
|
||||
@@ -625,7 +636,7 @@ export function getSystemDbOptions(project: Project): string[] {
|
||||
}
|
||||
|
||||
export function getSystemDatabase(name: string): SystemDatabase {
|
||||
return name === constants.master ? SystemDatabase.master : SystemDatabase.msdb;
|
||||
return name === constants.master ? SystemDatabase.Master : SystemDatabase.MSDB;
|
||||
}
|
||||
|
||||
export async function promptDacpacLocation(): Promise<vscode.Uri[] | undefined> {
|
||||
|
||||
@@ -6,18 +6,14 @@
|
||||
import path = require('path');
|
||||
import * as vscode from 'vscode';
|
||||
import * as constants from '../common/constants';
|
||||
import { getSqlProjectsInWorkspace, isValidSqlCmdVariableName, removeSqlCmdVariableFormatting } from '../common/utils';
|
||||
import { getSqlProjectsInWorkspace, isValidSqlCmdVariableName } from '../common/utils';
|
||||
import { DbServerValues, populateResultWithVars } from './utils';
|
||||
import { AddDatabaseReferenceSettings } from '../controllers/projectController';
|
||||
import { IDacpacReferenceSettings, IProjectReferenceSettings, ISystemDatabaseReferenceSettings } from '../models/IDatabaseReferenceSettings';
|
||||
import { Project } from '../models/project';
|
||||
import { getSystemDatabase, getSystemDbOptions, promptDacpacLocation } from './addDatabaseReferenceDialog';
|
||||
|
||||
interface DbServerValues {
|
||||
dbName?: string,
|
||||
dbVariable?: string,
|
||||
serverName?: string,
|
||||
serverVariable?: string
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create flow for adding a database reference using only VS Code-native APIs such as QuickPick
|
||||
@@ -93,10 +89,8 @@ async function addProjectReference(otherProjectsInWorkspace: vscode.Uri[]): Prom
|
||||
// User cancelled
|
||||
return;
|
||||
}
|
||||
referenceSettings.databaseName = dbServerValues.dbName;
|
||||
referenceSettings.databaseVariable = dbServerValues.dbVariable;
|
||||
referenceSettings.serverName = dbServerValues.serverName;
|
||||
referenceSettings.serverVariable = dbServerValues.serverVariable;
|
||||
|
||||
populateResultWithVars(referenceSettings, dbServerValues);
|
||||
|
||||
// 7. Prompt suppress unresolved ref errors
|
||||
const suppressErrors = await promptSuppressUnresolvedRefErrors();
|
||||
@@ -124,7 +118,7 @@ async function addSystemDatabaseReference(project: Project): Promise<ISystemData
|
||||
const suppressErrors = await promptSuppressUnresolvedRefErrors();
|
||||
|
||||
return {
|
||||
databaseName: dbName,
|
||||
databaseVariableLiteralValue: dbName,
|
||||
systemDb: getSystemDatabase(selectedSystemDb),
|
||||
suppressMissingDependenciesErrors: suppressErrors
|
||||
};
|
||||
@@ -181,14 +175,16 @@ async function addDacpacReference(project: Project): Promise<IDacpacReferenceSet
|
||||
// 5. Prompt suppress unresolved ref errors
|
||||
const suppressErrors = await promptSuppressUnresolvedRefErrors();
|
||||
|
||||
return {
|
||||
databaseName: dbServerValues.dbName,
|
||||
// 6. Construct result
|
||||
|
||||
const referenceSettings: IDacpacReferenceSettings = {
|
||||
dacpacFileLocation: dacPacLocation,
|
||||
databaseVariable: removeSqlCmdVariableFormatting(dbServerValues.dbVariable),
|
||||
serverName: dbServerValues.serverName,
|
||||
serverVariable: removeSqlCmdVariableFormatting(dbServerValues.serverVariable),
|
||||
suppressMissingDependenciesErrors: suppressErrors
|
||||
};
|
||||
|
||||
populateResultWithVars(referenceSettings, dbServerValues);
|
||||
|
||||
return referenceSettings;
|
||||
}
|
||||
|
||||
async function promptLocation(): Promise<string | undefined> {
|
||||
|
||||
@@ -9,6 +9,8 @@ import * as utils from '../common/utils';
|
||||
import * as mssql from 'mssql';
|
||||
import { HttpClient } from '../common/httpClient';
|
||||
import { AgreementInfo, DockerImageInfo } from '../models/deploy/deployProfile';
|
||||
import { IUserDatabaseReferenceSettings } from '../models/IDatabaseReferenceSettings';
|
||||
import { removeSqlCmdVariableFormatting } from '../common/utils';
|
||||
|
||||
/**
|
||||
* Gets connection name from connection object if there is one,
|
||||
@@ -214,3 +216,32 @@ export function mapExtractTargetEnum(inputTarget: string): mssql.ExtractTarget {
|
||||
throw new Error(constants.extractTargetRequired);
|
||||
}
|
||||
}
|
||||
|
||||
export interface DbServerValues {
|
||||
dbName?: string,
|
||||
dbVariable?: string,
|
||||
serverName?: string,
|
||||
serverVariable?: string
|
||||
}
|
||||
|
||||
export function populateResultWithVars(referenceSettings: IUserDatabaseReferenceSettings, dbServerValues: DbServerValues) {
|
||||
if (dbServerValues.dbVariable) {
|
||||
referenceSettings.databaseName = ensureSetOrDefined(dbServerValues.dbName);
|
||||
referenceSettings.databaseVariable = ensureSetOrDefined(removeSqlCmdVariableFormatting(dbServerValues.dbVariable));
|
||||
referenceSettings.serverName = ensureSetOrDefined(dbServerValues.serverName);
|
||||
referenceSettings.serverVariable = ensureSetOrDefined(removeSqlCmdVariableFormatting(dbServerValues.serverVariable));
|
||||
} else {
|
||||
referenceSettings.databaseVariableLiteralValue = ensureSetOrDefined(dbServerValues.dbName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns undefined for settings that are an empty string, meaning they are unset
|
||||
* @param setting
|
||||
*/
|
||||
export function ensureSetOrDefined(setting?: string): string | undefined {
|
||||
if (!setting || setting.trim().length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
return setting;
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { SystemDatabase } from 'mssql';
|
||||
import { Uri } from 'vscode';
|
||||
import { SystemDatabase } from './projectEntry';
|
||||
|
||||
export interface IDatabaseReferenceSettings {
|
||||
databaseName?: string;
|
||||
databaseVariableLiteralValue?: string;
|
||||
suppressMissingDependenciesErrors: boolean;
|
||||
}
|
||||
|
||||
@@ -15,18 +15,19 @@ export interface ISystemDatabaseReferenceSettings extends IDatabaseReferenceSett
|
||||
systemDb: SystemDatabase;
|
||||
}
|
||||
|
||||
export interface IDacpacReferenceSettings extends IDatabaseReferenceSettings {
|
||||
dacpacFileLocation: Uri;
|
||||
export interface IUserDatabaseReferenceSettings extends IDatabaseReferenceSettings {
|
||||
databaseName?: string;
|
||||
databaseVariable?: string;
|
||||
serverName?: string;
|
||||
serverVariable?: string;
|
||||
}
|
||||
|
||||
export interface IProjectReferenceSettings extends IDatabaseReferenceSettings {
|
||||
export interface IDacpacReferenceSettings extends IUserDatabaseReferenceSettings {
|
||||
dacpacFileLocation: Uri;
|
||||
}
|
||||
|
||||
export interface IProjectReferenceSettings extends IUserDatabaseReferenceSettings {
|
||||
projectRelativePath: Uri | undefined;
|
||||
projectName: string;
|
||||
projectGuid: string;
|
||||
databaseVariable?: string;
|
||||
serverName?: string;
|
||||
serverVariable?: string;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -44,25 +44,29 @@ export class FileProjectEntry extends ProjectEntry implements IFileProjectEntry
|
||||
}
|
||||
|
||||
export class DacpacReferenceProjectEntry extends FileProjectEntry implements IDatabaseReferenceProjectEntry {
|
||||
databaseSqlCmdVariableValue?: string;
|
||||
databaseSqlCmdVariableName?: string;
|
||||
databaseVariableLiteralValue?: string;
|
||||
databaseSqlCmdVariable?: string;
|
||||
serverName?: string;
|
||||
serverSqlCmdVariable?: string;
|
||||
serverSqlCmdVariableName?: string;
|
||||
serverSqlCmdVariableValue?: string;
|
||||
suppressMissingDependenciesErrors: boolean;
|
||||
|
||||
constructor(settings: IDacpacReferenceSettings) {
|
||||
super(settings.dacpacFileLocation, '', EntryType.DatabaseReference);
|
||||
this.databaseSqlCmdVariable = settings.databaseVariable;
|
||||
this.databaseVariableLiteralValue = settings.databaseName;
|
||||
this.serverName = settings.serverName;
|
||||
this.serverSqlCmdVariable = settings.serverVariable;
|
||||
super(settings.dacpacFileLocation, /* relativePath doesn't get set for database references */ '', EntryType.DatabaseReference);
|
||||
this.suppressMissingDependenciesErrors = settings.suppressMissingDependenciesErrors;
|
||||
|
||||
this.databaseVariableLiteralValue = settings.databaseVariableLiteralValue;
|
||||
this.databaseSqlCmdVariableName = settings.databaseName;
|
||||
this.databaseSqlCmdVariableValue = settings.databaseVariable;
|
||||
|
||||
this.serverSqlCmdVariableName = settings.serverName;
|
||||
this.serverSqlCmdVariableValue = settings.serverVariable;
|
||||
}
|
||||
|
||||
/**
|
||||
* File name that gets displayed in the project tree
|
||||
*/
|
||||
public get databaseName(): string {
|
||||
public get referenceName(): string {
|
||||
return path.parse(utils.getPlatformSafeFileEntryPath(this.fsUri.fsPath)).name;
|
||||
}
|
||||
|
||||
@@ -73,49 +77,44 @@ export class DacpacReferenceProjectEntry extends FileProjectEntry implements IDa
|
||||
}
|
||||
|
||||
export class SystemDatabaseReferenceProjectEntry extends FileProjectEntry implements IDatabaseReferenceProjectEntry {
|
||||
constructor(uri: Uri, public ssdtUri: Uri, public databaseVariableLiteralValue: string | undefined, public suppressMissingDependenciesErrors: boolean) {
|
||||
super(uri, '', EntryType.DatabaseReference);
|
||||
constructor(public referenceName: string, public databaseVariableLiteralValue: string | undefined, public suppressMissingDependenciesErrors: boolean) {
|
||||
super(Uri.file(referenceName), referenceName, EntryType.DatabaseReference);
|
||||
}
|
||||
|
||||
/**
|
||||
* File name that gets displayed in the project tree
|
||||
* Returns the name of the system database - this is used for deleting the system database reference
|
||||
*/
|
||||
public get databaseName(): string {
|
||||
return path.parse(utils.getPlatformSafeFileEntryPath(this.fsUri.fsPath)).name;
|
||||
}
|
||||
|
||||
public override pathForSqlProj(): string {
|
||||
// need to remove the leading slash for system database path for build to work on Windows
|
||||
return utils.convertSlashesForSqlProj(this.fsUri.path.substring(1));
|
||||
}
|
||||
|
||||
public ssdtPathForSqlProj(): string {
|
||||
// need to remove the leading slash for system database path for build to work on Windows
|
||||
return utils.convertSlashesForSqlProj(this.ssdtUri.path.substring(1));
|
||||
return this.referenceName;
|
||||
}
|
||||
}
|
||||
|
||||
export class SqlProjectReferenceProjectEntry extends FileProjectEntry implements IDatabaseReferenceProjectEntry {
|
||||
projectName: string;
|
||||
projectGuid: string;
|
||||
databaseVariableLiteralValue?: string;
|
||||
databaseSqlCmdVariable?: string;
|
||||
serverName?: string;
|
||||
serverSqlCmdVariable?: string;
|
||||
suppressMissingDependenciesErrors: boolean;
|
||||
public projectName: string;
|
||||
public projectGuid: string;
|
||||
public databaseVariableLiteralValue?: string;
|
||||
public databaseSqlCmdVariableName?: string;
|
||||
public databaseSqlCmdVariableValue?: string;
|
||||
public serverSqlCmdVariableName?: string;
|
||||
public serverSqlCmdVariableValue?: string;
|
||||
public suppressMissingDependenciesErrors: boolean;
|
||||
|
||||
constructor(settings: IProjectReferenceSettings) {
|
||||
super(settings.projectRelativePath!, '', EntryType.DatabaseReference);
|
||||
super(settings.projectRelativePath!, /* relativePath doesn't get set for database references */ '', EntryType.DatabaseReference);
|
||||
|
||||
this.projectName = settings.projectName;
|
||||
this.projectGuid = settings.projectGuid;
|
||||
this.databaseSqlCmdVariable = settings.databaseVariable;
|
||||
this.databaseVariableLiteralValue = settings.databaseName;
|
||||
this.serverName = settings.serverName;
|
||||
this.serverSqlCmdVariable = settings.serverVariable;
|
||||
this.suppressMissingDependenciesErrors = settings.suppressMissingDependenciesErrors;
|
||||
|
||||
this.databaseVariableLiteralValue = settings.databaseVariableLiteralValue;
|
||||
this.databaseSqlCmdVariableName = settings.databaseName;
|
||||
this.databaseSqlCmdVariableValue = settings.databaseVariable;
|
||||
|
||||
this.serverSqlCmdVariableName = settings.serverName;
|
||||
this.serverSqlCmdVariableValue = settings.serverVariable;
|
||||
}
|
||||
|
||||
public get databaseName(): string {
|
||||
public get referenceName(): string {
|
||||
return this.projectName;
|
||||
}
|
||||
|
||||
@@ -136,8 +135,3 @@ export enum DatabaseReferenceLocation {
|
||||
differentDatabaseSameServer,
|
||||
differentDatabaseDifferentServer
|
||||
}
|
||||
|
||||
export enum SystemDatabase {
|
||||
master,
|
||||
msdb
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as path from 'path';
|
||||
import { DatabaseProjectItemType } from '../../common/constants';
|
||||
|
||||
/**
|
||||
* Base class for an item that appears in the ADS project tree
|
||||
@@ -21,6 +22,10 @@ export abstract class BaseProjectTreeItem {
|
||||
|
||||
abstract get treeItem(): vscode.TreeItem;
|
||||
|
||||
abstract get type(): DatabaseProjectItemType;
|
||||
|
||||
public entryKey?: string;
|
||||
|
||||
public get friendlyName(): string {
|
||||
return path.parse(this.relativeProjectUri.path).base;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ export class DatabaseReferencesTreeItem extends BaseProjectTreeItem {
|
||||
*/
|
||||
constructor(projectNodeName: string, sqlprojUri: vscode.Uri, databaseReferences: IDatabaseReferenceProjectEntry[]) {
|
||||
super(vscode.Uri.file(path.join(projectNodeName, constants.databaseReferencesNodeName)), sqlprojUri);
|
||||
|
||||
this.construct(databaseReferences);
|
||||
}
|
||||
|
||||
@@ -44,9 +43,13 @@ export class DatabaseReferencesTreeItem extends BaseProjectTreeItem {
|
||||
return this.references;
|
||||
}
|
||||
|
||||
public get type(): constants.DatabaseProjectItemType {
|
||||
return constants.DatabaseProjectItemType.referencesRoot;
|
||||
}
|
||||
|
||||
public get treeItem(): vscode.TreeItem {
|
||||
const refFolderItem = new vscode.TreeItem(this.relativeProjectUri, vscode.TreeItemCollapsibleState.Collapsed);
|
||||
refFolderItem.contextValue = constants.DatabaseProjectItemType.referencesRoot;
|
||||
refFolderItem.contextValue = this.type;
|
||||
refFolderItem.iconPath = IconPathHelper.referenceGroup;
|
||||
|
||||
return refFolderItem;
|
||||
@@ -55,17 +58,22 @@ export class DatabaseReferencesTreeItem extends BaseProjectTreeItem {
|
||||
|
||||
export class DatabaseReferenceTreeItem extends BaseProjectTreeItem {
|
||||
constructor(private reference: IDatabaseReferenceProjectEntry, referencesNodeRelativeProjectUri: vscode.Uri, sqlprojUri: vscode.Uri) {
|
||||
super(vscode.Uri.file(path.join(referencesNodeRelativeProjectUri.fsPath, reference.databaseName)), sqlprojUri);
|
||||
super(vscode.Uri.file(path.join(referencesNodeRelativeProjectUri.fsPath, reference.referenceName)), sqlprojUri);
|
||||
this.entryKey = this.friendlyName;
|
||||
}
|
||||
|
||||
public get children(): BaseProjectTreeItem[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
public get type(): constants.DatabaseProjectItemType {
|
||||
return constants.DatabaseProjectItemType.reference;
|
||||
}
|
||||
|
||||
public get treeItem(): vscode.TreeItem {
|
||||
const refItem = new vscode.TreeItem(this.relativeProjectUri, vscode.TreeItemCollapsibleState.None);
|
||||
refItem.label = this.reference.databaseName;
|
||||
refItem.contextValue = constants.DatabaseProjectItemType.reference;
|
||||
refItem.label = this.reference.referenceName;
|
||||
refItem.contextValue = this.type;
|
||||
refItem.iconPath = IconPathHelper.referenceDatabase;
|
||||
|
||||
return refItem;
|
||||
|
||||
@@ -16,19 +16,25 @@ import { IconPathHelper } from '../../common/iconHelper';
|
||||
export class FolderNode extends BaseProjectTreeItem {
|
||||
public fileChildren: { [childName: string]: (FolderNode | FileNode) } = {};
|
||||
public fileSystemUri: vscode.Uri;
|
||||
public override entryKey: string;
|
||||
|
||||
constructor(folderPath: vscode.Uri, sqlprojUri: vscode.Uri) {
|
||||
constructor(folderPath: vscode.Uri, sqlprojUri: vscode.Uri, entryKey: string) {
|
||||
super(fsPathToProjectUri(folderPath, sqlprojUri), sqlprojUri);
|
||||
this.fileSystemUri = folderPath;
|
||||
this.entryKey = entryKey;
|
||||
}
|
||||
|
||||
public get children(): BaseProjectTreeItem[] {
|
||||
return Object.values(this.fileChildren).sort(sortFileFolderNodes);
|
||||
}
|
||||
|
||||
public get type(): DatabaseProjectItemType {
|
||||
return DatabaseProjectItemType.folder;
|
||||
}
|
||||
|
||||
public get treeItem(): vscode.TreeItem {
|
||||
const folderItem = new vscode.TreeItem(this.fileSystemUri, vscode.TreeItemCollapsibleState.Collapsed);
|
||||
folderItem.contextValue = DatabaseProjectItemType.folder;
|
||||
folderItem.contextValue = this.type;
|
||||
folderItem.iconPath = IconPathHelper.folder;
|
||||
|
||||
return folderItem;
|
||||
@@ -40,10 +46,12 @@ export class FolderNode extends BaseProjectTreeItem {
|
||||
*/
|
||||
export abstract class FileNode extends BaseProjectTreeItem {
|
||||
public fileSystemUri: vscode.Uri;
|
||||
public override entryKey: string;
|
||||
|
||||
constructor(filePath: vscode.Uri, sqlprojUri: vscode.Uri) {
|
||||
constructor(filePath: vscode.Uri, sqlprojUri: vscode.Uri, entryKey: string) {
|
||||
super(fsPathToProjectUri(filePath, sqlprojUri, true), sqlprojUri);
|
||||
this.fileSystemUri = filePath;
|
||||
this.entryKey = entryKey;
|
||||
}
|
||||
|
||||
public get children(): BaseProjectTreeItem[] {
|
||||
@@ -68,64 +76,92 @@ export abstract class FileNode extends BaseProjectTreeItem {
|
||||
export class SqlObjectFileNode extends FileNode {
|
||||
public override get treeItem(): vscode.TreeItem {
|
||||
const treeItem = super.treeItem;
|
||||
treeItem.contextValue = DatabaseProjectItemType.sqlObjectScript;
|
||||
treeItem.contextValue = this.type;
|
||||
|
||||
return treeItem;
|
||||
}
|
||||
|
||||
public get type(): DatabaseProjectItemType {
|
||||
return DatabaseProjectItemType.sqlObjectScript;
|
||||
}
|
||||
}
|
||||
|
||||
export class ExternalStreamingJobFileNode extends SqlObjectFileNode {
|
||||
public override get treeItem(): vscode.TreeItem {
|
||||
const treeItem = super.treeItem;
|
||||
treeItem.contextValue = DatabaseProjectItemType.externalStreamingJob;
|
||||
treeItem.contextValue = this.type;
|
||||
|
||||
return treeItem;
|
||||
}
|
||||
|
||||
public override get type(): DatabaseProjectItemType {
|
||||
return DatabaseProjectItemType.externalStreamingJob;
|
||||
}
|
||||
}
|
||||
|
||||
export class TableFileNode extends SqlObjectFileNode {
|
||||
public override get treeItem(): vscode.TreeItem {
|
||||
const treeItem = super.treeItem;
|
||||
treeItem.contextValue = DatabaseProjectItemType.table;
|
||||
treeItem.contextValue = this.type;
|
||||
|
||||
return treeItem;
|
||||
}
|
||||
|
||||
public override get type(): DatabaseProjectItemType {
|
||||
return DatabaseProjectItemType.table;
|
||||
}
|
||||
}
|
||||
|
||||
export class PreDeployNode extends FileNode {
|
||||
public override get treeItem(): vscode.TreeItem {
|
||||
const treeItem = super.treeItem;
|
||||
treeItem.contextValue = DatabaseProjectItemType.preDeploymentScript;
|
||||
treeItem.contextValue = this.type;
|
||||
|
||||
return treeItem;
|
||||
}
|
||||
|
||||
public get type(): DatabaseProjectItemType {
|
||||
return DatabaseProjectItemType.preDeploymentScript;
|
||||
}
|
||||
}
|
||||
|
||||
export class PostDeployNode extends FileNode {
|
||||
public override get treeItem(): vscode.TreeItem {
|
||||
const treeItem = super.treeItem;
|
||||
treeItem.contextValue = DatabaseProjectItemType.postDeploymentScript;
|
||||
treeItem.contextValue = this.type;
|
||||
|
||||
return treeItem;
|
||||
}
|
||||
|
||||
public get type(): DatabaseProjectItemType {
|
||||
return DatabaseProjectItemType.postDeploymentScript;
|
||||
}
|
||||
}
|
||||
|
||||
export class NoneNode extends FileNode {
|
||||
public override get treeItem(): vscode.TreeItem {
|
||||
const treeItem = super.treeItem;
|
||||
treeItem.contextValue = DatabaseProjectItemType.noneFile;
|
||||
treeItem.contextValue = this.type;
|
||||
|
||||
return treeItem;
|
||||
}
|
||||
|
||||
public get type(): DatabaseProjectItemType {
|
||||
return DatabaseProjectItemType.noneFile;
|
||||
}
|
||||
}
|
||||
|
||||
export class PublishProfileNode extends FileNode {
|
||||
public override get treeItem(): vscode.TreeItem {
|
||||
const treeItem = super.treeItem;
|
||||
treeItem.contextValue = DatabaseProjectItemType.publishProfile;
|
||||
treeItem.contextValue = this.type;
|
||||
|
||||
return treeItem;
|
||||
}
|
||||
|
||||
public get type(): DatabaseProjectItemType {
|
||||
return DatabaseProjectItemType.publishProfile;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,12 +10,13 @@ import * as fileTree from './fileFolderTreeItem';
|
||||
import { Project } from '../project';
|
||||
import * as utils from '../../common/utils';
|
||||
import { DatabaseReferencesTreeItem } from './databaseReferencesTreeItem';
|
||||
import { DatabaseProjectItemType, RelativeOuterPath, ExternalStreamingJob, sqlprojExtension, CollapseProjectNodesKey } from '../../common/constants';
|
||||
import { DatabaseProjectItemType, RelativeOuterPath, ExternalStreamingJob, sqlprojExtension, CollapseProjectNodesKey, errorPrefix } from '../../common/constants';
|
||||
import { IconPathHelper } from '../../common/iconHelper';
|
||||
import { FileProjectEntry } from '../projectEntry';
|
||||
import { EntryType } from 'sqldbproj';
|
||||
import { DBProjectConfigurationKey } from '../../tools/netcoreTool';
|
||||
import { SqlCmdVariablesTreeItem } from './sqlcmdVariableTreeItem';
|
||||
import { ProjectType } from 'mssql';
|
||||
|
||||
/**
|
||||
* TreeNode root that represents an entire project
|
||||
@@ -51,62 +52,62 @@ export class ProjectRootTreeItem extends BaseProjectTreeItem {
|
||||
public get treeItem(): vscode.TreeItem {
|
||||
const collapsibleState = vscode.workspace.getConfiguration(DBProjectConfigurationKey)[CollapseProjectNodesKey] ? vscode.TreeItemCollapsibleState.Collapsed : vscode.TreeItemCollapsibleState.Expanded;
|
||||
const projectItem = new vscode.TreeItem(this.fileSystemUri, collapsibleState);
|
||||
projectItem.contextValue = this.project.isSdkStyleProject ? DatabaseProjectItemType.project : DatabaseProjectItemType.legacyProject;
|
||||
projectItem.contextValue = this.type;
|
||||
projectItem.iconPath = IconPathHelper.databaseProject;
|
||||
projectItem.label = this.projectNodeName;
|
||||
|
||||
return projectItem;
|
||||
}
|
||||
|
||||
public get type(): DatabaseProjectItemType {
|
||||
return this.project.sqlProjStyle === ProjectType.SdkStyle ? DatabaseProjectItemType.project : DatabaseProjectItemType.legacyProject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the list of files in a project file to constructs the tree
|
||||
*/
|
||||
private construct() {
|
||||
// folders
|
||||
// Note: folders must be sorted to ensure that parent folders come before their children
|
||||
for (const folder of this.project.folders.sort((a, b) => a.relativePath < b.relativePath ? -1 : (a.relativePath > b.relativePath ? 1 : 0))) {
|
||||
const newNode = new fileTree.FolderNode(folder.fsUri, this.projectFileUri, folder.relativePath);
|
||||
this.addNode(newNode, folder);
|
||||
}
|
||||
|
||||
// pre deploy scripts
|
||||
for (const preDeployEntry of this.project.preDeployScripts) {
|
||||
const newNode = new fileTree.PreDeployNode(preDeployEntry.fsUri, this.projectFileUri);
|
||||
const newNode = new fileTree.PreDeployNode(preDeployEntry.fsUri, this.projectFileUri, preDeployEntry.relativePath);
|
||||
this.addNode(newNode, preDeployEntry);
|
||||
}
|
||||
|
||||
// post deploy scripts
|
||||
for (const postDeployEntry of this.project.postDeployScripts) {
|
||||
const newNode = new fileTree.PostDeployNode(postDeployEntry.fsUri, this.projectFileUri);
|
||||
const newNode = new fileTree.PostDeployNode(postDeployEntry.fsUri, this.projectFileUri, postDeployEntry.relativePath);
|
||||
this.addNode(newNode, postDeployEntry);
|
||||
}
|
||||
|
||||
// none scripts
|
||||
for (const noneEntry of this.project.noneDeployScripts) {
|
||||
const newNode = new fileTree.NoneNode(noneEntry.fsUri, this.projectFileUri);
|
||||
const newNode = new fileTree.NoneNode(noneEntry.fsUri, this.projectFileUri, noneEntry.relativePath);
|
||||
this.addNode(newNode, noneEntry);
|
||||
}
|
||||
|
||||
// publish profiles
|
||||
for (const publishProfile of this.project.publishProfiles) {
|
||||
const newNode = new fileTree.PublishProfileNode(publishProfile.fsUri, this.projectFileUri);
|
||||
const newNode = new fileTree.PublishProfileNode(publishProfile.fsUri, this.projectFileUri, publishProfile.relativePath);
|
||||
this.addNode(newNode, publishProfile);
|
||||
}
|
||||
|
||||
// sql object scripts and folders
|
||||
// sql object scripts
|
||||
for (const entry of this.project.files) {
|
||||
let newNode: fileTree.FolderNode | fileTree.FileNode;
|
||||
let newNode: fileTree.FileNode;
|
||||
|
||||
switch (entry.type) {
|
||||
case EntryType.File:
|
||||
if (entry.sqlObjectType === ExternalStreamingJob) {
|
||||
newNode = new fileTree.ExternalStreamingJobFileNode(entry.fsUri, this.projectFileUri);
|
||||
} else if (entry.containsCreateTableStatement) {
|
||||
newNode = new fileTree.TableFileNode(entry.fsUri, this.projectFileUri);
|
||||
}
|
||||
else {
|
||||
newNode = new fileTree.SqlObjectFileNode(entry.fsUri, this.projectFileUri);
|
||||
}
|
||||
|
||||
break;
|
||||
case EntryType.Folder:
|
||||
newNode = new fileTree.FolderNode(entry.fsUri, this.projectFileUri);
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown EntryType: '${entry.type}'`);
|
||||
if (entry.sqlObjectType === ExternalStreamingJob) {
|
||||
newNode = new fileTree.ExternalStreamingJobFileNode(entry.fsUri, this.projectFileUri, entry.relativePath);
|
||||
} else if (entry.containsCreateTableStatement) {
|
||||
newNode = new fileTree.TableFileNode(entry.fsUri, this.projectFileUri, entry.relativePath);
|
||||
} else {
|
||||
newNode = new fileTree.SqlObjectFileNode(entry.fsUri, this.projectFileUri, entry.relativePath);
|
||||
}
|
||||
|
||||
this.addNode(newNode, entry);
|
||||
@@ -138,23 +139,26 @@ export class ProjectRootTreeItem extends BaseProjectTreeItem {
|
||||
return this; // if nothing left after trimming the entry itself, must been root
|
||||
}
|
||||
|
||||
if (relativePathParts[0] === RelativeOuterPath) {
|
||||
if (relativePathParts[0] === RelativeOuterPath) { // scripts external to the project folder are always parented by the project root node because external folders aren't supported
|
||||
return this;
|
||||
}
|
||||
|
||||
let current: fileTree.FolderNode | ProjectRootTreeItem = this;
|
||||
let current: fileTree.FolderNode | ProjectRootTreeItem = this; // start with the Project root node
|
||||
|
||||
for (const part of relativePathParts) {
|
||||
for (const part of relativePathParts) { // iterate from the project root, down the path to the entry in question
|
||||
if (current.fileChildren[part] === undefined) {
|
||||
const parentPath = current instanceof ProjectRootTreeItem ? path.dirname(current.fileSystemUri.fsPath) : current.fileSystemUri.fsPath;
|
||||
current.fileChildren[part] = new fileTree.FolderNode(vscode.Uri.file(path.join(parentPath, part)), this.projectFileUri);
|
||||
// DacFx.Projects populates the list of folders with those implicitly included via parentage.
|
||||
// e.g. <Folder Include="MySchema\Tables"> and <Build Include="MySchema\SomeScript.sql"> both result in the "MySchema" folder being automatically added,
|
||||
// even if there's no <Folder Include="MySchema"> entry.
|
||||
// Project tree unit tests need to explicitly include parent folders because they bypass DacFx's logic, or they'll hit this error.
|
||||
throw new Error(errorPrefix(`All parent nodes for ${relativePathParts} should have already been added.`));
|
||||
}
|
||||
|
||||
if (current.fileChildren[part] instanceof fileTree.FileNode) {
|
||||
return current;
|
||||
return current; // if we've made it to the node in question, we're done
|
||||
}
|
||||
else {
|
||||
current = current.fileChildren[part] as fileTree.FolderNode | ProjectRootTreeItem;
|
||||
current = current.fileChildren[part] as fileTree.FolderNode; // otherwise, shift the current node down, and repeat
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,9 +45,13 @@ export class SqlCmdVariablesTreeItem extends BaseProjectTreeItem {
|
||||
return this.sqlcmdVariableTreeItems;
|
||||
}
|
||||
|
||||
public get type(): constants.DatabaseProjectItemType {
|
||||
return constants.DatabaseProjectItemType.sqlcmdVariablesRoot;
|
||||
}
|
||||
|
||||
public get treeItem(): vscode.TreeItem {
|
||||
const sqlCmdVariableFolderItem = new vscode.TreeItem(this.relativeProjectUri, vscode.TreeItemCollapsibleState.Collapsed);
|
||||
sqlCmdVariableFolderItem.contextValue = constants.DatabaseProjectItemType.sqlcmdVariablesRoot;
|
||||
sqlCmdVariableFolderItem.contextValue = this.type;
|
||||
sqlCmdVariableFolderItem.iconPath = IconPathHelper.sqlCmdVariablesGroup;
|
||||
|
||||
return sqlCmdVariableFolderItem;
|
||||
@@ -60,16 +64,21 @@ export class SqlCmdVariablesTreeItem extends BaseProjectTreeItem {
|
||||
export class SqlCmdVariableTreeItem extends BaseProjectTreeItem {
|
||||
constructor(private sqlcmdVar: string, sqlCmdNodeRelativeProjectUri: vscode.Uri, sqlprojUri: vscode.Uri,) {
|
||||
super(vscode.Uri.file(path.join(sqlCmdNodeRelativeProjectUri.fsPath, sqlcmdVar)), sqlprojUri);
|
||||
this.entryKey = this.friendlyName;
|
||||
}
|
||||
|
||||
public get children(): BaseProjectTreeItem[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
public get type(): constants.DatabaseProjectItemType {
|
||||
return constants.DatabaseProjectItemType.sqlcmdVariable;
|
||||
}
|
||||
|
||||
public get treeItem(): vscode.TreeItem {
|
||||
const sqlcmdVariableItem = new vscode.TreeItem(this.relativeProjectUri, vscode.TreeItemCollapsibleState.None);
|
||||
sqlcmdVariableItem.label = this.sqlcmdVar;
|
||||
sqlcmdVariableItem.contextValue = constants.DatabaseProjectItemType.sqlcmdVariable;
|
||||
sqlcmdVariableItem.contextValue = this.type;
|
||||
sqlcmdVariableItem.iconPath = IconPathHelper.sqlCmdVariable;
|
||||
|
||||
return sqlcmdVariableItem;
|
||||
|
||||
@@ -40,7 +40,7 @@ export class SqlDatabaseProjectProvider implements dataworkspace.IProjectProvide
|
||||
*/
|
||||
public async getProjectTreeDataProvider(projectFilePath: vscode.Uri): Promise<vscode.TreeDataProvider<BaseProjectTreeItem>> {
|
||||
const provider = new SqlDatabaseProjectTreeViewProvider();
|
||||
const project = await Project.openProject(projectFilePath.fsPath);
|
||||
const project = await Project.openProject(projectFilePath.fsPath, true, true);
|
||||
|
||||
// open project in STS
|
||||
const sqlProjectsService = await getSqlProjectsService();
|
||||
@@ -112,7 +112,7 @@ export class SqlDatabaseProjectProvider implements dataworkspace.IProjectProvide
|
||||
* Opens and loads a .sqlproj file
|
||||
*/
|
||||
public openProject(projectFilePath: string): Promise<sqldbproj.ISqlProject> {
|
||||
return Project.openProject(projectFilePath);
|
||||
return Project.openProject(projectFilePath, true, true);
|
||||
}
|
||||
|
||||
public addItemPrompt(project: sqldbproj.ISqlProject, relativeFilePath: string, options?: sqldbproj.AddItemOptions): Promise<void> {
|
||||
|
||||
@@ -149,18 +149,35 @@ declare module 'sqldbproj' {
|
||||
readProjFile(): Promise<void>;
|
||||
|
||||
/**
|
||||
* Adds the list of sql files and directories to the project, and saves the project file
|
||||
*
|
||||
* @param list list of files and folder Uris. Files and folders must already exist. No files or folders will be added if any do not exist.
|
||||
* Adds a pre-deployment script
|
||||
* @param relativePath
|
||||
*/
|
||||
addToProject(list: vscode.Uri[]): Promise<void>;
|
||||
addPreDeploymentScript(relativePath: string): Promise<void>;
|
||||
|
||||
/**
|
||||
* Adds a post-deployment script
|
||||
* @param relativePath
|
||||
*/
|
||||
addPostDeploymentScript(relativePath: string): Promise<void>;
|
||||
|
||||
/**
|
||||
* Add a SQL object script that will be included in the schema
|
||||
* @param relativePath
|
||||
*/
|
||||
addSqlObjectScript(relativePath: string): Promise<void>;
|
||||
|
||||
/**
|
||||
* Adds multiple SQL object scripts that will be included in the schema
|
||||
* @param relativePaths Array of paths relative to the .sqlproj file
|
||||
*/
|
||||
addSqlObjectScripts(relativePaths: string[]): Promise<void>;
|
||||
|
||||
/**
|
||||
* Adds a folder to the project, and saves the project file
|
||||
*
|
||||
* @param relativeFolderPath Relative path of the folder
|
||||
*/
|
||||
addFolderItem(relativeFolderPath: string): Promise<IFileProjectEntry>;
|
||||
addFolder(relativeFolderPath: string): Promise<void>;
|
||||
|
||||
/**
|
||||
* Writes a file to disk if contents are provided, adds that file to the project, and writes it to disk
|
||||
@@ -194,18 +211,6 @@ declare module 'sqldbproj' {
|
||||
*/
|
||||
removeDatabaseSource(databaseSource: string): Promise<void>;
|
||||
|
||||
/**
|
||||
* Excludes entry from project by removing it from the project file
|
||||
* @param entry
|
||||
*/
|
||||
exclude(entry: IFileProjectEntry): Promise<void>;
|
||||
|
||||
/**
|
||||
* Deletes file or folder and removes it from the project file
|
||||
* @param entry
|
||||
*/
|
||||
deleteFileFolder(entry: IFileProjectEntry): Promise<void>;
|
||||
|
||||
/**
|
||||
* returns the sql version the project is targeting
|
||||
*/
|
||||
@@ -290,7 +295,7 @@ declare module 'sqldbproj' {
|
||||
* Represents a database reference entry in a project file
|
||||
*/
|
||||
export interface IDatabaseReferenceProjectEntry extends IFileProjectEntry {
|
||||
databaseName: string;
|
||||
referenceName: string;
|
||||
databaseVariableLiteralValue?: string;
|
||||
suppressMissingDependenciesErrors: boolean;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ export function macroExpansion(template: string, macroDict: Record<string, strin
|
||||
return output;
|
||||
}
|
||||
|
||||
async function loadObjectTypeInfo(key: string, friendlyName: string, templateFolderPath: string, fileName: string): Promise<string> {
|
||||
async function loadObjectTypeInfo(key: ItemType, friendlyName: string, templateFolderPath: string, fileName: string): Promise<string> {
|
||||
const template = await loadTemplate(templateFolderPath, fileName);
|
||||
scriptTypes.push(new ProjectScriptType(key, friendlyName, template));
|
||||
|
||||
@@ -89,11 +89,11 @@ async function loadTemplate(templateFolderPath: string, fileName: string): Promi
|
||||
}
|
||||
|
||||
export class ProjectScriptType {
|
||||
type: string;
|
||||
type: ItemType;
|
||||
friendlyName: string;
|
||||
templateScript: string;
|
||||
|
||||
constructor(type: string, friendlyName: string, templateScript: string) {
|
||||
constructor(type: ItemType, friendlyName: string, templateScript: string) {
|
||||
this.type = type;
|
||||
this.friendlyName = friendlyName;
|
||||
this.templateScript = templateScript;
|
||||
|
||||
@@ -25,7 +25,7 @@ describe('Autorest tests', function (): void {
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
after(async function(): Promise<void> {
|
||||
after(async function (): Promise<void> {
|
||||
await testUtils.deleteGeneratedTestFolder();
|
||||
});
|
||||
|
||||
@@ -41,7 +41,7 @@ describe('Autorest tests', function (): void {
|
||||
sinon.stub(window, 'showInformationMessage').returns(<any>Promise.resolve(runViaNpx)); // stub a selection in case test runner doesn't have autorest installed
|
||||
|
||||
const autorestHelper = new AutorestHelper(testContext.outputChannel);
|
||||
const dummyFile = path.join(await testUtils.generateTestFolderPath(), 'testoutput.log');
|
||||
const dummyFile = path.join(await testUtils.generateTestFolderPath(this.test), 'testoutput.log');
|
||||
sinon.stub(autorestHelper, 'constructAutorestCommand').returns(`${await autorestHelper.detectInstallation()} --version > ${dummyFile}`);
|
||||
|
||||
try {
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<Name>TestProjectName</Name>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectVersion>4.1</ProjectVersion>
|
||||
<ProjectGuid>{BA5EBA11-C0DE-5EA7-ACED-BABB1E70A575}</ProjectGuid>
|
||||
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql150DatabaseSchemaProvider</DSP>
|
||||
<OutputType>Database</OutputType>
|
||||
<RootPath>
|
||||
</RootPath>
|
||||
<RootNamespace>TestProjectName</RootNamespace>
|
||||
<AssemblyName>TestProjectName</AssemblyName>
|
||||
<ModelCollation>1033, CI</ModelCollation>
|
||||
<DefaultFileStructure>BySchemaAndSchemaType</DefaultFileStructure>
|
||||
<DeployToDatabase>True</DeployToDatabase>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetLanguage>CS</TargetLanguage>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<SqlServerVerification>False</SqlServerVerification>
|
||||
<IncludeCompositeObjects>True</IncludeCompositeObjects>
|
||||
<TargetDatabaseSet>True</TargetDatabaseSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
|
||||
<!-- Default to the v11.0 targets path if the targets file for the current VS version is not found -->
|
||||
<SSDTExists Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>
|
||||
<VisualStudioVersion Condition="'$(SSDTExists)' == ''">11.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' != ''" Project="$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' == ''" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties" />
|
||||
<Folder Include="Tables" />
|
||||
<Folder Include="Views" />
|
||||
<Folder Include="Views\Maintenance" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Build Include="Tables\Users.sql" />
|
||||
<Build Include="Tables\Action History.sql" />
|
||||
<Build Include="Views\Maintenance\Database Performance.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Views\User" />
|
||||
<Build Include="Views\User\Profile.sql" />
|
||||
</ItemGroup>
|
||||
<Import Condition="'$(NetCoreBuild)' == 'true'" Project="$(NETCoreTargetsPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<ItemGroup>
|
||||
<PackageReference Condition="'$(NetCoreBuild)' == 'true'" Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<Target Name="BeforeBuild">
|
||||
<Delete Files="$(BaseIntermediateOutputPath)\project.assets.json" />
|
||||
</Target>
|
||||
<ItemGroup>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' == 'true'" Include="$(NETCoreTargetsPath)\SystemDacpacs\150\master.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' != 'true'" Include="$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\150\SqlSchemas\master.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,80 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<Name>TestProjectName</Name>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectVersion>4.1</ProjectVersion>
|
||||
<ProjectGuid>{BA5EBA11-C0DE-5EA7-ACED-BABB1E70A575}</ProjectGuid>
|
||||
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql150DatabaseSchemaProvider</DSP>
|
||||
<OutputType>Database</OutputType>
|
||||
<RootPath>
|
||||
</RootPath>
|
||||
<RootNamespace>TestProjectName</RootNamespace>
|
||||
<AssemblyName>TestProjectName</AssemblyName>
|
||||
<ModelCollation>1033, CI</ModelCollation>
|
||||
<DefaultFileStructure>BySchemaAndSchemaType</DefaultFileStructure>
|
||||
<DeployToDatabase>True</DeployToDatabase>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetLanguage>CS</TargetLanguage>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<SqlServerVerification>False</SqlServerVerification>
|
||||
<IncludeCompositeObjects>True</IncludeCompositeObjects>
|
||||
<TargetDatabaseSet>True</TargetDatabaseSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
|
||||
<!-- Default to the v11.0 targets path if the targets file for the current VS version is not found -->
|
||||
<SSDTExists Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>
|
||||
<VisualStudioVersion Condition="'$(SSDTExists)' == ''">11.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' != ''" Project="$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' == ''" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<Target Name="BeforeBuild">
|
||||
<!-- Custom logic added by user -->
|
||||
<Delete Files="$(BaseIntermediateOutputPath)\project.assets.json" />
|
||||
</Target>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties" />
|
||||
<Folder Include="Tables" />
|
||||
<Folder Include="Views" />
|
||||
<Folder Include="Views\Maintenance" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Build Include="Tables\Users.sql" />
|
||||
<Build Include="Tables\Action History.sql" />
|
||||
<Build Include="Views\Maintenance\Database Performance.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Views\User" />
|
||||
<Build Include="Views\User\Profile.sql" />
|
||||
</ItemGroup>
|
||||
<Import Condition="'$(NetCoreBuild)' == 'true'" Project="$(NETCoreTargetsPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<ItemGroup>
|
||||
<PackageReference Condition="'$(NetCoreBuild)' == 'true'" Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,97 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<Name>TestProjectName</Name>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectVersion>4.1</ProjectVersion>
|
||||
<ProjectGuid>{BA5EBA11-C0DE-5EA7-ACED-BABB1E70A575}</ProjectGuid>
|
||||
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql150DatabaseSchemaProvider</DSP>
|
||||
<OutputType>Database</OutputType>
|
||||
<RootPath>
|
||||
</RootPath>
|
||||
<RootNamespace>TestProjectName</RootNamespace>
|
||||
<AssemblyName>TestProjectName</AssemblyName>
|
||||
<ModelCollation>1033, CI</ModelCollation>
|
||||
<DefaultFileStructure>BySchemaAndSchemaType</DefaultFileStructure>
|
||||
<DeployToDatabase>True</DeployToDatabase>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetLanguage>CS</TargetLanguage>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<SqlServerVerification>False</SqlServerVerification>
|
||||
<IncludeCompositeObjects>True</IncludeCompositeObjects>
|
||||
<TargetDatabaseSet>True</TargetDatabaseSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
|
||||
<!-- Default to the v11.0 targets path if the targets file for the current VS version is not found -->
|
||||
<SSDTExists Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>
|
||||
<VisualStudioVersion Condition="'$(SSDTExists)' == ''">11.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' != ''" Project="$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' == ''" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties" />
|
||||
<Folder Include="Tables" />
|
||||
<Folder Include="Views" />
|
||||
<Folder Include="Views\Maintenance" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Build Include="Tables\Users.sql" />
|
||||
<Build Include="Tables\Action History.sql" />
|
||||
<Build Include="Views\Maintenance\Database Performance.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Views\User" />
|
||||
<Build Include="Views\User\Profile.sql" />
|
||||
</ItemGroup>
|
||||
<Import Condition="'$(NetCoreBuild)' == 'true'" Project="$(NETCoreTargetsPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<ItemGroup>
|
||||
<PackageReference Condition="'$(NetCoreBuild)' == 'true'" Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<Target Name="BeforeBuild">
|
||||
<Delete Files="$(BaseIntermediateOutputPath)\project.assets.json" />
|
||||
</Target>
|
||||
<ItemGroup>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' == 'true'" Include="$(NETCoreTargetsPath)\SystemDacpacs\150\master.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' != 'true'" Include="$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\150\SqlSchemas\master.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' == 'true'" Include="$(NETCoreTargetsPath)\SystemDacpacs\150\msdb.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>msdb</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' != 'true'" Include="$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\150\SqlSchemas\msdb.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>msdb</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -9,25 +9,16 @@ import { promises as fs } from 'fs';
|
||||
// Project baselines
|
||||
export let newProjectFileBaseline: string;
|
||||
export let newProjectFileWithScriptBaseline: string;
|
||||
export let newProjectFileNoPropertiesFolderBaseline: string;
|
||||
export let openProjectFileBaseline: string;
|
||||
export let openProjectFileReleaseConfigurationBaseline: string;
|
||||
export let openProjectFileUnknownConfigurationBaseline: string;
|
||||
export let openProjectFileSingleOutputPathBaseline: string;
|
||||
export let openProjectFileMultipleOutputPathBaseline: string;
|
||||
export let openDataSourcesBaseline: string;
|
||||
export let SSDTProjectFileBaseline: string;
|
||||
export let SSDTProjectAfterUpdateBaseline: string;
|
||||
export let SSDTUpdatedProjectBaseline: string;
|
||||
export let SSDTUpdatedProjectAfterSystemDbUpdateBaseline: string;
|
||||
export let SSDTProjectBaselineWithBeforeBuildTarget: string;
|
||||
export let SSDTProjectBaselineWithBeforeBuildTargetAfterUpdate: string;
|
||||
export let publishProfileIntegratedSecurityBaseline: string;
|
||||
export let publishProfileSqlLoginBaseline: string;
|
||||
export let publishProfileDefaultValueBaseline: string;
|
||||
export let openProjectWithProjectReferencesBaseline: string;
|
||||
export let openSqlProjectWithPrePostDeploymentError: string;
|
||||
export let openSqlProjectWithAdditionalSqlCmdVariablesBaseline: string;
|
||||
export let sqlProjectMissingVersionBaseline: string;
|
||||
export let sqlProjectInvalidVersionBaseline: string;
|
||||
export let sqlProjectCustomCollationBaseline: string;
|
||||
@@ -38,34 +29,24 @@ export let newStyleProjectSdkImportAttributeBaseline: string;
|
||||
export let openSdkStyleSqlProjectBaseline: string;
|
||||
export let openSdkStyleSqlProjectWithFilesSpecifiedBaseline: string;
|
||||
export let openSdkStyleSqlProjectWithGlobsSpecifiedBaseline: string;
|
||||
export let openSdkStyleSqlProjectWithBuildRemoveBaseline: string;
|
||||
export let openSdkStyleSqlProjectNoProjectGuidBaseline: string;
|
||||
export let openSqlProjectWithAdditionalPublishProfileBaseline: string;
|
||||
export let sqlProjPropertyReadBaseline: string;
|
||||
export let databaseReferencesReadBaseline: string;
|
||||
|
||||
const baselineFolderPath = __dirname;
|
||||
|
||||
export async function loadBaselines() {
|
||||
newProjectFileBaseline = await loadBaseline(baselineFolderPath, 'newSqlProjectBaseline.xml');
|
||||
newProjectFileWithScriptBaseline = await loadBaseline(baselineFolderPath, 'newSqlProjectWithScriptBaseline.xml');
|
||||
newProjectFileNoPropertiesFolderBaseline = await loadBaseline(baselineFolderPath, 'newSqlProjectNoPropertiesFolderBaseline.xml');
|
||||
openProjectFileBaseline = await loadBaseline(baselineFolderPath, 'openSqlProjectBaseline.xml');
|
||||
openProjectFileReleaseConfigurationBaseline = await loadBaseline(baselineFolderPath, 'openSqlProjectReleaseConfigurationBaseline.xml');
|
||||
openProjectFileUnknownConfigurationBaseline = await loadBaseline(baselineFolderPath, 'openSqlProjectUnknownConfigurationBaseline.xml');
|
||||
openProjectFileSingleOutputPathBaseline = await loadBaseline(baselineFolderPath, 'openSqlProjectSingleOutputPathBaseline.xml');
|
||||
openProjectFileMultipleOutputPathBaseline = await loadBaseline(baselineFolderPath, 'openSqlProjectMultipleOutputPathBaseline.xml');
|
||||
openDataSourcesBaseline = await loadBaseline(baselineFolderPath, 'openDataSourcesBaseline.json');
|
||||
SSDTProjectFileBaseline = await loadBaseline(baselineFolderPath, 'SSDTProjectBaseline.xml');
|
||||
SSDTProjectAfterUpdateBaseline = await loadBaseline(baselineFolderPath, 'SSDTProjectAfterUpdateBaseline.xml');
|
||||
SSDTUpdatedProjectBaseline = await loadBaseline(baselineFolderPath, 'SSDTUpdatedProjectBaseline.xml');
|
||||
SSDTUpdatedProjectAfterSystemDbUpdateBaseline = await loadBaseline(baselineFolderPath, 'SSDTUpdatedProjectAfterSystemDbUpdateBaseline.xml');
|
||||
SSDTProjectBaselineWithBeforeBuildTarget = await loadBaseline(baselineFolderPath, 'SSDTProjectBaselineWithBeforeBuildTarget.xml');
|
||||
SSDTProjectBaselineWithBeforeBuildTargetAfterUpdate = await loadBaseline(baselineFolderPath, 'SSDTProjectBaselineWithBeforeBuildTargetAfterUpdate.xml');
|
||||
publishProfileIntegratedSecurityBaseline = await loadBaseline(baselineFolderPath, 'publishProfileIntegratedSecurityBaseline.publish.xml');
|
||||
publishProfileSqlLoginBaseline = await loadBaseline(baselineFolderPath, 'publishProfileSqlLoginBaseline.publish.xml');
|
||||
publishProfileDefaultValueBaseline = await loadBaseline(baselineFolderPath, 'publishProfileDefaultValueBaseline.publish.xml');
|
||||
openProjectWithProjectReferencesBaseline = await loadBaseline(baselineFolderPath, 'openSqlProjectWithProjectReferenceBaseline.xml');
|
||||
openSqlProjectWithPrePostDeploymentError = await loadBaseline(baselineFolderPath, 'openSqlProjectWithPrePostDeploymentError.xml');
|
||||
openSqlProjectWithAdditionalSqlCmdVariablesBaseline = await loadBaseline(baselineFolderPath, 'openSqlProjectWithAdditionalSqlCmdVariablesBaseline.xml');
|
||||
sqlProjectMissingVersionBaseline = await loadBaseline(baselineFolderPath, 'sqlProjectMissingVersionBaseline.xml');
|
||||
sqlProjectInvalidVersionBaseline = await loadBaseline(baselineFolderPath, 'sqlProjectInvalidVersionBaseline.xml');
|
||||
sqlProjectCustomCollationBaseline = await loadBaseline(baselineFolderPath, 'sqlProjectCustomCollationBaseline.xml');
|
||||
@@ -76,9 +57,8 @@ export async function loadBaselines() {
|
||||
openSdkStyleSqlProjectBaseline = await loadBaseline(baselineFolderPath, 'openSdkStyleSqlProjectBaseline.xml');
|
||||
openSdkStyleSqlProjectWithFilesSpecifiedBaseline = await loadBaseline(baselineFolderPath, 'openSdkStyleSqlProjectWithFilesSpecifiedBaseline.xml');
|
||||
openSdkStyleSqlProjectWithGlobsSpecifiedBaseline = await loadBaseline(baselineFolderPath, 'openSdkStyleSqlProjectWithGlobsSpecifiedBaseline.xml');
|
||||
openSdkStyleSqlProjectWithBuildRemoveBaseline = await loadBaseline(baselineFolderPath, 'openSdkStyleSqlProjectWithBuildRemoveBaseline.xml');
|
||||
openSdkStyleSqlProjectNoProjectGuidBaseline = await loadBaseline(baselineFolderPath, 'openSdkStyleSqlProjectNoProjectGuidBaseline.xml');
|
||||
openSqlProjectWithAdditionalPublishProfileBaseline = await loadBaseline(baselineFolderPath, 'openSqlProjectWithAdditionalPublishProfileBaseline.xml');
|
||||
sqlProjPropertyReadBaseline = await loadBaseline(baselineFolderPath, 'sqlProjPropertyRead.xml');
|
||||
databaseReferencesReadBaseline = await loadBaseline(baselineFolderPath, 'databaseReferencesReadBaseline.xml');
|
||||
}
|
||||
|
||||
async function loadBaseline(baselineFolderPath: string, fileName: string): Promise<string> {
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build">
|
||||
<Sdk Name="Microsoft.Build.Sql" Version="0.1.3-preview" />
|
||||
<PropertyGroup>
|
||||
<Name>ReferenceTest</Name>
|
||||
<ProjectGuid>{843865B6-7286-4DA7-ADA3-BD5EA485B40A}</ProjectGuid>
|
||||
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql150DatabaseSchemaProvider</DSP>
|
||||
<ModelCollation>1033, CI</ModelCollation>
|
||||
</PropertyGroup>
|
||||
<Target Name="BeforeBuild">
|
||||
<Delete Files="$(BaseIntermediateOutputPath)\project.assets.json" />
|
||||
</Target>
|
||||
<ItemGroup>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' == 'true'" Include="$(SystemDacpacsLocation)\SystemDacpacs\150\msdb.dacpac">
|
||||
<SuppressMissingDependenciesErrors>True</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>msdbLiteral</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' != 'true'" Include="$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\150\SqlSchemas\msdb.dacpac">
|
||||
<SuppressMissingDependenciesErrors>True</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>msdbLiteral</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
<ArtifactReference Include="..\ReferencedDacpac\ReferencedDacpac.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseSqlCmdVariable>dacpacDbVar</DatabaseSqlCmdVariable>
|
||||
<ServerSqlCmdVariable>dacpacServerVar</ServerSqlCmdVariable>
|
||||
</ArtifactReference>
|
||||
<ArtifactReference Include="..\OtherDacpac\OtherDacpac.dacpac">
|
||||
<SuppressMissingDependenciesErrors>True</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>OtherDacpacLiteral</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<SqlCmdVariable Include="projDbVar">
|
||||
<DefaultValue>projDbVar</DefaultValue>
|
||||
<Value>$(SqlCmdVar__1)</Value>
|
||||
</SqlCmdVariable>
|
||||
<SqlCmdVariable Include="projServerVar">
|
||||
<DefaultValue>projServerName</DefaultValue>
|
||||
<Value>$(SqlCmdVar__2)</Value>
|
||||
</SqlCmdVariable>
|
||||
<SqlCmdVariable Include="dacpacDbVar">
|
||||
<DefaultValue>dacpacDbName</DefaultValue>
|
||||
<Value>$(SqlCmdVar__3)</Value>
|
||||
</SqlCmdVariable>
|
||||
<SqlCmdVariable Include="dacpacServerVar">
|
||||
<DefaultValue>dacpacServerName</DefaultValue>
|
||||
<Value>$(SqlCmdVar__4)</Value>
|
||||
</SqlCmdVariable>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ReferencedProject\ReferencedProject.sqlproj">
|
||||
<Name>ReferencedProject</Name>
|
||||
<Project>{BA5EBA11-C0DE-5EA7-ACED-BABB1E70A575}</Project>
|
||||
<Private>True</Private>
|
||||
<SuppressMissingDependenciesErrors>True</SuppressMissingDependenciesErrors>
|
||||
<DatabaseSqlCmdVariable>projDbVar</DatabaseSqlCmdVariable>
|
||||
<ServerSqlCmdVariable>projServerVar</ServerSqlCmdVariable>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\OtherProject\OtherProject.sqlproj">
|
||||
<Name>OtherProject</Name>
|
||||
<Project>{C0DEBA11-BA5E-5EA7-ACE5-BABB1E70A575}</Project>
|
||||
<Private>True</Private>
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>OtherProjLiteral</DatabaseVariableLiteralValue>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,64 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<Name>TestProjectName</Name>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectVersion>4.1</ProjectVersion>
|
||||
<ProjectGuid>{BA5EBA11-C0DE-5EA7-ACED-BABB1E70A575}</ProjectGuid>
|
||||
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql160DatabaseSchemaProvider</DSP>
|
||||
<OutputType>Database</OutputType>
|
||||
<RootPath>
|
||||
</RootPath>
|
||||
<RootNamespace>TestProjectName</RootNamespace>
|
||||
<AssemblyName>TestProjectName</AssemblyName>
|
||||
<ModelCollation>1033, CI</ModelCollation>
|
||||
<DefaultFileStructure>BySchemaAndSchemaType</DefaultFileStructure>
|
||||
<DeployToDatabase>True</DeployToDatabase>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetLanguage>CS</TargetLanguage>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<SqlServerVerification>False</SqlServerVerification>
|
||||
<IncludeCompositeObjects>True</IncludeCompositeObjects>
|
||||
<TargetDatabaseSet>True</TargetDatabaseSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
|
||||
<!-- Default to the v11.0 targets path if the targets file for the current VS version is not found -->
|
||||
<SSDTExists Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>
|
||||
<VisualStudioVersion Condition="'$(SSDTExists)' == ''">11.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Condition="'$(NetCoreBuild)' == 'true'" Project="$(NETCoreTargetsPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets"/>
|
||||
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' != ''" Project="$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' == ''" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<ItemGroup>
|
||||
<PackageReference Condition="'$(NetCoreBuild)' == 'true'" Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<Target Name="BeforeBuild">
|
||||
<Delete Files="$(BaseIntermediateOutputPath)\project.assets.json" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build">
|
||||
<Sdk Name="Microsoft.Build.Sql" Version="0.1.7-preview" />
|
||||
<PropertyGroup>
|
||||
<Name>TestProjectName</Name>
|
||||
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql150DatabaseSchemaProvider</DSP>
|
||||
<ModelCollation>1033, CI</ModelCollation>
|
||||
</PropertyGroup>
|
||||
<Target Name="BeforeBuild">
|
||||
<Delete Files="$(BaseIntermediateOutputPath)\project.assets.json" />
|
||||
</Target>
|
||||
<ItemGroup>
|
||||
<SqlCmdVariable Include="ProdDatabaseName">
|
||||
<DefaultValue>MyProdDatabase</DefaultValue>
|
||||
<Value>$(SqlCmdVar__1)</Value>
|
||||
</SqlCmdVariable>
|
||||
<SqlCmdVariable Include="BackupDatabaseName">
|
||||
<DefaultValue>MyBackupDatabase</DefaultValue>
|
||||
<Value>$(SqlCmdVar__2)</Value>
|
||||
</SqlCmdVariable>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PreDeploy Include="Script.PreDeployment1.sql" />
|
||||
<None Include="Script.PreDeployment2.sql" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,37 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build">
|
||||
<Sdk Name="Microsoft.Build.Sql" Version="0.1.7-preview" />
|
||||
<PropertyGroup>
|
||||
<Name>TestProjectName</Name>
|
||||
<ProjectGuid>{2C283C5D-9E4A-4313-8FF9-4E0CEE20B063}</ProjectGuid>
|
||||
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql150DatabaseSchemaProvider</DSP>
|
||||
<ModelCollation>1033, CI</ModelCollation>
|
||||
</PropertyGroup>
|
||||
<Target Name="BeforeBuild">
|
||||
<Delete Files="$(BaseIntermediateOutputPath)\project.assets.json" />
|
||||
</Target>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Build Include="..\other\folder1\file*.sql" />
|
||||
<Build Remove="..\other\folder1\file1.sql" />
|
||||
<Build Include="..\other\folder2\file2.sql" />
|
||||
<Build Remove="..\other\folder2\**" />
|
||||
<Build Remove="folder1\*.sql" />
|
||||
<Build Include="folder1\file2.sql" />
|
||||
<Build Remove="folder2\file3.sql" />
|
||||
<Build Include="folder2\*.sql" />
|
||||
<Build Remove="file1.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' == 'true'" Include="$(SystemDacpacsLocation)\SystemDacpacs\150\master.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' != 'true'" Include="$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\150\SqlSchemas\master.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,114 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<Name>TestProjectName</Name>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectVersion>4.1</ProjectVersion>
|
||||
<ProjectGuid>{BA5EBA11-C0DE-5EA7-ACED-BABB1E70A575}</ProjectGuid>
|
||||
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql150DatabaseSchemaProvider</DSP>
|
||||
<OutputType>Database</OutputType>
|
||||
<RootPath>
|
||||
</RootPath>
|
||||
<RootNamespace>TestProjectName</RootNamespace>
|
||||
<AssemblyName>TestProjectName</AssemblyName>
|
||||
<ModelCollation>1033, CI</ModelCollation>
|
||||
<DefaultFileStructure>BySchemaAndSchemaType</DefaultFileStructure>
|
||||
<DeployToDatabase>True</DeployToDatabase>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetLanguage>CS</TargetLanguage>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<SqlServerVerification>False</SqlServerVerification>
|
||||
<IncludeCompositeObjects>True</IncludeCompositeObjects>
|
||||
<TargetDatabaseSet>True</TargetDatabaseSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OutputPath>bin\other</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
|
||||
<!-- Default to the v11.0 targets path if the targets file for the current VS version is not found -->
|
||||
<SSDTExists Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>
|
||||
<VisualStudioVersion Condition="'$(SSDTExists)' == ''">11.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Condition="'$(NetCoreBuild)' == 'true'" Project="$(NETCoreTargetsPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets"/>
|
||||
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' != ''" Project="$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' == ''" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<ItemGroup>
|
||||
<PackageReference Condition="'$(NetCoreBuild)' == 'true'" Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties" />
|
||||
<Folder Include="Tables" />
|
||||
<Folder Include="Views" />
|
||||
<Folder Include="Views\Maintenance" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Build Include="Tables\Users.sql" />
|
||||
<Build Include="Tables\Action History.sql" />
|
||||
<Build Include="Views\Maintenance\Database Performance.sql" />
|
||||
<Build Include="..\Test\Test.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Views\User" />
|
||||
<Build Include="Views\User\Profile.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Build Include="MyExternalStreamingJob.sql" Type="ExternalStreamingJob" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<SqlCmdVariable Include="ProdDatabaseName">
|
||||
<DefaultValue>MyProdDatabase</DefaultValue>
|
||||
<Value>$(SqlCmdVar__1)</Value>
|
||||
</SqlCmdVariable>
|
||||
<SqlCmdVariable Include="BackupDatabaseName">
|
||||
<DefaultValue>MyBackupDatabase</DefaultValue>
|
||||
<Value>$(SqlCmdVar__2)</Value>
|
||||
</SqlCmdVariable>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' == 'true'" Include="$(NETCoreTargetsPath)\SystemDacpacs\150\master.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' != 'true'" Include="$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\150\SqlSchemas\master.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PreDeploy Include="Script.PreDeployment1.sql" />
|
||||
<None Include="Script.PreDeployment2.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PostDeploy Include="Script.PostDeployment1.sql" />
|
||||
<None Include="Tables\Script.PostDeployment1.sql" />
|
||||
</ItemGroup>
|
||||
<Target Name="BeforeBuild">
|
||||
<Delete Files="$(BaseIntermediateOutputPath)\project.assets.json" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,111 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<Name>TestProjectName</Name>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectVersion>4.1</ProjectVersion>
|
||||
<ProjectGuid>{BA5EBA11-C0DE-5EA7-ACED-BABB1E70A575}</ProjectGuid>
|
||||
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql150DatabaseSchemaProvider</DSP>
|
||||
<OutputType>Database</OutputType>
|
||||
<RootPath>
|
||||
</RootPath>
|
||||
<RootNamespace>TestProjectName</RootNamespace>
|
||||
<AssemblyName>TestProjectName</AssemblyName>
|
||||
<ModelCollation>1033, CI</ModelCollation>
|
||||
<DefaultFileStructure>BySchemaAndSchemaType</DefaultFileStructure>
|
||||
<DeployToDatabase>True</DeployToDatabase>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetLanguage>CS</TargetLanguage>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<SqlServerVerification>False</SqlServerVerification>
|
||||
<IncludeCompositeObjects>True</IncludeCompositeObjects>
|
||||
<TargetDatabaseSet>True</TargetDatabaseSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
|
||||
<!-- Default to the v11.0 targets path if the targets file for the current VS version is not found -->
|
||||
<SSDTExists Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>
|
||||
<VisualStudioVersion Condition="'$(SSDTExists)' == ''">11.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Condition="'$(NetCoreBuild)' == 'true'" Project="$(NETCoreTargetsPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets"/>
|
||||
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' != ''" Project="$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' == ''" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<ItemGroup>
|
||||
<PackageReference Condition="'$(NetCoreBuild)' == 'true'" Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties" />
|
||||
<Folder Include="Tables" />
|
||||
<Folder Include="Views" />
|
||||
<Folder Include="Views\Maintenance" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Build Include="Tables\Users.sql" />
|
||||
<Build Include="Tables\Action History.sql" />
|
||||
<Build Include="Views\Maintenance\Database Performance.sql" />
|
||||
<Build Include="..\Test\Test.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Views\User" />
|
||||
<Build Include="Views\User\Profile.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Build Include="MyExternalStreamingJob.sql" Type="ExternalStreamingJob" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<SqlCmdVariable Include="ProdDatabaseName">
|
||||
<DefaultValue>MyProdDatabase</DefaultValue>
|
||||
<Value>$(SqlCmdVar__1)</Value>
|
||||
</SqlCmdVariable>
|
||||
<SqlCmdVariable Include="BackupDatabaseName">
|
||||
<DefaultValue>MyBackupDatabase</DefaultValue>
|
||||
<Value>$(SqlCmdVar__2)</Value>
|
||||
</SqlCmdVariable>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' == 'true'" Include="$(NETCoreTargetsPath)\SystemDacpacs\150\master.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' != 'true'" Include="$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\150\SqlSchemas\master.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PreDeploy Include="Script.PreDeployment1.sql" />
|
||||
<None Include="Script.PreDeployment2.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PostDeploy Include="Script.PostDeployment1.sql" />
|
||||
<None Include="Tables\Script.PostDeployment1.sql" />
|
||||
</ItemGroup>
|
||||
<Target Name="BeforeBuild">
|
||||
<Delete Files="$(BaseIntermediateOutputPath)\project.assets.json" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,89 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<Name>TestProjectName</Name>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectVersion>4.1</ProjectVersion>
|
||||
<ProjectGuid>{BA5EBA11-C0DE-5EA7-ACED-BABB1E70A575}</ProjectGuid>
|
||||
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql150DatabaseSchemaProvider</DSP>
|
||||
<OutputType>Database</OutputType>
|
||||
<RootPath>
|
||||
</RootPath>
|
||||
<RootNamespace>TestProjectName</RootNamespace>
|
||||
<AssemblyName>TestProjectName</AssemblyName>
|
||||
<ModelCollation>1033, CI</ModelCollation>
|
||||
<DefaultFileStructure>BySchemaAndSchemaType</DefaultFileStructure>
|
||||
<DeployToDatabase>True</DeployToDatabase>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetLanguage>CS</TargetLanguage>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<SqlServerVerification>False</SqlServerVerification>
|
||||
<IncludeCompositeObjects>True</IncludeCompositeObjects>
|
||||
<TargetDatabaseSet>True</TargetDatabaseSet>
|
||||
<OutputPath>..\otherFolder</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
|
||||
<!-- Default to the v11.0 targets path if the targets file for the current VS version is not found -->
|
||||
<SSDTExists Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>
|
||||
<VisualStudioVersion Condition="'$(SSDTExists)' == ''">11.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Condition="'$(NetCoreBuild)' == 'true'" Project="$(NETCoreTargetsPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets"/>
|
||||
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' != ''" Project="$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' == ''" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<ItemGroup>
|
||||
<PackageReference Condition="'$(NetCoreBuild)' == 'true'" Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties" />
|
||||
<Folder Include="Tables" />
|
||||
<Folder Include="Views" />
|
||||
<Folder Include="Views\Maintenance" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Build Include="Tables\Users.sql" />
|
||||
<Build Include="Tables\Action History.sql" />
|
||||
<Build Include="Views\Maintenance\Database Performance.sql" />
|
||||
<Build Include="..\Test\Test.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Views\User" />
|
||||
<Build Include="Views\User\Profile.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Build Include="MyExternalStreamingJob.sql" Type="ExternalStreamingJob" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<SqlCmdVariable Include="ProdDatabaseName">
|
||||
<DefaultValue>MyProdDatabase</DefaultValue>
|
||||
<Value>$(SqlCmdVar__1)</Value>
|
||||
</SqlCmdVariable>
|
||||
<SqlCmdVariable Include="BackupDatabaseName">
|
||||
<DefaultValue>MyBackupDatabase</DefaultValue>
|
||||
<Value>$(SqlCmdVar__2)</Value>
|
||||
</SqlCmdVariable>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' == 'true'" Include="$(NETCoreTargetsPath)\SystemDacpacs\150\master.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' != 'true'" Include="$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\150\SqlSchemas\master.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PreDeploy Include="Script.PreDeployment1.sql" />
|
||||
<None Include="Script.PreDeployment2.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PostDeploy Include="Script.PostDeployment1.sql" />
|
||||
<None Include="Tables\Script.PostDeployment1.sql" />
|
||||
</ItemGroup>
|
||||
<Target Name="BeforeBuild">
|
||||
<Delete Files="$(BaseIntermediateOutputPath)\project.assets.json" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,111 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Unknown</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<Name>TestProjectName</Name>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectVersion>4.1</ProjectVersion>
|
||||
<ProjectGuid>{BA5EBA11-C0DE-5EA7-ACED-BABB1E70A575}</ProjectGuid>
|
||||
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql150DatabaseSchemaProvider</DSP>
|
||||
<OutputType>Database</OutputType>
|
||||
<RootPath>
|
||||
</RootPath>
|
||||
<RootNamespace>TestProjectName</RootNamespace>
|
||||
<AssemblyName>TestProjectName</AssemblyName>
|
||||
<ModelCollation>1033, CI</ModelCollation>
|
||||
<DefaultFileStructure>BySchemaAndSchemaType</DefaultFileStructure>
|
||||
<DeployToDatabase>True</DeployToDatabase>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetLanguage>CS</TargetLanguage>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<SqlServerVerification>False</SqlServerVerification>
|
||||
<IncludeCompositeObjects>True</IncludeCompositeObjects>
|
||||
<TargetDatabaseSet>True</TargetDatabaseSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
|
||||
<!-- Default to the v11.0 targets path if the targets file for the current VS version is not found -->
|
||||
<SSDTExists Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>
|
||||
<VisualStudioVersion Condition="'$(SSDTExists)' == ''">11.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Condition="'$(NetCoreBuild)' == 'true'" Project="$(NETCoreTargetsPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets"/>
|
||||
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' != ''" Project="$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' == ''" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<ItemGroup>
|
||||
<PackageReference Condition="'$(NetCoreBuild)' == 'true'" Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties" />
|
||||
<Folder Include="Tables" />
|
||||
<Folder Include="Views" />
|
||||
<Folder Include="Views\Maintenance" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Build Include="Tables\Users.sql" />
|
||||
<Build Include="Tables\Action History.sql" />
|
||||
<Build Include="Views\Maintenance\Database Performance.sql" />
|
||||
<Build Include="..\Test\Test.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Views\User" />
|
||||
<Build Include="Views\User\Profile.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Build Include="MyExternalStreamingJob.sql" Type="ExternalStreamingJob" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<SqlCmdVariable Include="ProdDatabaseName">
|
||||
<DefaultValue>MyProdDatabase</DefaultValue>
|
||||
<Value>$(SqlCmdVar__1)</Value>
|
||||
</SqlCmdVariable>
|
||||
<SqlCmdVariable Include="BackupDatabaseName">
|
||||
<DefaultValue>MyBackupDatabase</DefaultValue>
|
||||
<Value>$(SqlCmdVar__2)</Value>
|
||||
</SqlCmdVariable>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' == 'true'" Include="$(NETCoreTargetsPath)\SystemDacpacs\150\master.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' != 'true'" Include="$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\150\SqlSchemas\master.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PreDeploy Include="Script.PreDeployment1.sql" />
|
||||
<None Include="Script.PreDeployment2.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PostDeploy Include="Script.PostDeployment1.sql" />
|
||||
<None Include="Tables\Script.PostDeployment1.sql" />
|
||||
</ItemGroup>
|
||||
<Target Name="BeforeBuild">
|
||||
<Delete Files="$(BaseIntermediateOutputPath)\project.assets.json" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,117 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<Name>TestProjectName</Name>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectVersion>4.1</ProjectVersion>
|
||||
<ProjectGuid>{BA5EBA11-C0DE-5EA7-ACED-BABB1E70A575}</ProjectGuid>
|
||||
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql150DatabaseSchemaProvider</DSP>
|
||||
<OutputType>Database</OutputType>
|
||||
<RootPath>
|
||||
</RootPath>
|
||||
<RootNamespace>TestProjectName</RootNamespace>
|
||||
<AssemblyName>TestProjectName</AssemblyName>
|
||||
<ModelCollation>1033, CI</ModelCollation>
|
||||
<DefaultFileStructure>BySchemaAndSchemaType</DefaultFileStructure>
|
||||
<DeployToDatabase>True</DeployToDatabase>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetLanguage>CS</TargetLanguage>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<SqlServerVerification>False</SqlServerVerification>
|
||||
<IncludeCompositeObjects>True</IncludeCompositeObjects>
|
||||
<TargetDatabaseSet>True</TargetDatabaseSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
|
||||
<!-- Default to the v11.0 targets path if the targets file for the current VS version is not found -->
|
||||
<SSDTExists Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>
|
||||
<VisualStudioVersion Condition="'$(SSDTExists)' == ''">11.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Condition="'$(NetCoreBuild)' == 'true'" Project="$(NETCoreTargetsPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' != ''" Project="$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' == ''" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<ItemGroup>
|
||||
<PackageReference Condition="'$(NetCoreBuild)' == 'true'" Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties" />
|
||||
<Folder Include="Tables" />
|
||||
<Folder Include="Views" />
|
||||
<Folder Include="Views\Maintenance" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Build Include="Tables\Users.sql" />
|
||||
<Build Include="Tables\Action History.sql" />
|
||||
<Build Include="Views\Maintenance\Database Performance.sql" />
|
||||
<Build Include="..\Test\Test.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Views\User" />
|
||||
<Build Include="Views\User\Profile.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Build Include="MyExternalStreamingJob.sql" Type="ExternalStreamingJob" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<SqlCmdVariable Include="ProdDatabaseName">
|
||||
<DefaultValue>MyProdDatabase</DefaultValue>
|
||||
<Value>$(SqlCmdVar__1)</Value>
|
||||
</SqlCmdVariable>
|
||||
<SqlCmdVariable Include="BackupDatabaseName">
|
||||
<DefaultValue>MyBackupDatabase</DefaultValue>
|
||||
<Value>$(SqlCmdVar__2)</Value>
|
||||
</SqlCmdVariable>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' == 'true'" Include="$(NETCoreTargetsPath)\SystemDacpacs\150\master.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' != 'true'" Include="$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\150\SqlSchemas\master.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PreDeploy Include="Script.PreDeployment1.sql" />
|
||||
<None Include="Script.PreDeployment2.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PostDeploy Include="Script.PostDeployment1.sql" />
|
||||
<None Include="Tables\Script.PostDeployment1.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="TestProjectName_1.publish.xml" />
|
||||
<None Include="TestProjectName_2.publish.xml" />
|
||||
<None Include="TestProjectName_3.publish.xml" />
|
||||
<None Include="TestProjectName_4.publish.xml" />
|
||||
</ItemGroup>
|
||||
<Target Name="BeforeBuild">
|
||||
<Delete Files="$(BaseIntermediateOutputPath)\project.assets.json" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<Name>TestProjectName</Name>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectVersion>4.1</ProjectVersion>
|
||||
<ProjectGuid>{BA5EBA11-C0DE-5EA7-ACED-BABB1E70A575}</ProjectGuid>
|
||||
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql150DatabaseSchemaProvider</DSP>
|
||||
<OutputType>Database</OutputType>
|
||||
<RootPath>
|
||||
</RootPath>
|
||||
<RootNamespace>TestProjectName</RootNamespace>
|
||||
<AssemblyName>TestProjectName</AssemblyName>
|
||||
<ModelCollation>1033, CI</ModelCollation>
|
||||
<DefaultFileStructure>BySchemaAndSchemaType</DefaultFileStructure>
|
||||
<DeployToDatabase>True</DeployToDatabase>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetLanguage>CS</TargetLanguage>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<SqlServerVerification>False</SqlServerVerification>
|
||||
<IncludeCompositeObjects>True</IncludeCompositeObjects>
|
||||
<TargetDatabaseSet>True</TargetDatabaseSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
|
||||
<!-- Default to the v11.0 targets path if the targets file for the current VS version is not found -->
|
||||
<SSDTExists Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>
|
||||
<VisualStudioVersion Condition="'$(SSDTExists)' == ''">11.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Condition="'$(NetCoreBuild)' == 'true'" Project="$(NETCoreTargetsPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' != ''" Project="$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' == ''" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<ItemGroup>
|
||||
<PackageReference Condition="'$(NetCoreBuild)' == 'true'" Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties" />
|
||||
<Folder Include="Tables" />
|
||||
<Folder Include="Views" />
|
||||
<Folder Include="Views\Maintenance" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Build Include="Tables\Users.sql" />
|
||||
<Build Include="Tables\Action History.sql" />
|
||||
<Build Include="Views\Maintenance\Database Performance.sql" />
|
||||
<Build Include="..\Test\Test.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Views\User" />
|
||||
<Build Include="Views\User\Profile.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Build Include="MyExternalStreamingJob.sql" Type="ExternalStreamingJob" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<SqlCmdVariable Include="BackupDatabaseName">
|
||||
<DefaultValue>MyBackupDatabase</DefaultValue>
|
||||
<Value>$(SqlCmdVar__2)</Value>
|
||||
</SqlCmdVariable>
|
||||
<SqlCmdVariable Include="TestDatabaseName">
|
||||
<DefaultValue>TestDb</DefaultValue>
|
||||
<Value>$(SqlCmdVar__3)</Value>
|
||||
</SqlCmdVariable>
|
||||
<SqlCmdVariable Include="ProdDatabaseName">
|
||||
<DefaultValue>NewProdName</DefaultValue>
|
||||
<Value>$(SqlCmdVar__4)</Value>
|
||||
</SqlCmdVariable>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' == 'true'" Include="$(NETCoreTargetsPath)\SystemDacpacs\150\master.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
<ArtifactReference Condition="'$(NetCoreBuild)' != 'true'" Include="$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\150\SqlSchemas\master.dacpac">
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
|
||||
</ArtifactReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PreDeploy Include="Script.PreDeployment1.sql" />
|
||||
<None Include="Script.PreDeployment2.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PostDeploy Include="Script.PostDeployment1.sql" />
|
||||
<None Include="Tables\Script.PostDeployment1.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="TestProjectName_1.publish.xml" />
|
||||
<None Include="TestProjectName_2.publish.xml" />
|
||||
<None Include="TestProjectName_3.publish.xml" />
|
||||
</ItemGroup>
|
||||
<Target Name="BeforeBuild">
|
||||
<Delete Files="$(BaseIntermediateOutputPath)\project.assets.json" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -95,12 +95,18 @@
|
||||
</ArtifactReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ReferencedProject\TestProject.sqlproj">
|
||||
<Name>TestProjectName</Name>
|
||||
<SqlCmdVariable Include="ReferencedTestProjectName">
|
||||
<DefaultValue>MyReferencedTestDatabase</DefaultValue>
|
||||
<Value>$(SqlCmdVar__1)</Value>
|
||||
</SqlCmdVariable>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ReferencedProject\ReferencedTestProject.sqlproj">
|
||||
<Name>ReferencedTestProjectName</Name>
|
||||
<Project>{f9008554-068f-4f91-979a-58bd1f7c8f6e}</Project>
|
||||
<Private>True</Private>
|
||||
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
|
||||
<DatabaseSqlCmdVariable>TestProjectName</DatabaseSqlCmdVariable>
|
||||
<DatabaseSqlCmdVariable>ReferencedTestProjectName</DatabaseSqlCmdVariable>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Target Name="BeforeBuild">
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build">
|
||||
<Sdk Name="Microsoft.Build.Sql" Version="0.1.9-preview" />
|
||||
<PropertyGroup>
|
||||
<Name>SdkStyle</Name>
|
||||
<ProjectGuid>{BA5EBA11-C0DE-5EA7-ACED-BABB1E70A575}</ProjectGuid>
|
||||
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql130DatabaseSchemaProvider</DSP>
|
||||
<ModelCollation>1041, CI</ModelCollation>
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
<OutputPath>CustomOutputPath\Dacpacs\</OutputPath>
|
||||
<DefaultCollation>Japanese_CI_AS</DefaultCollation>
|
||||
<DatabaseSource>oneSource;twoSource;redSource;blueSource</DatabaseSource>
|
||||
</PropertyGroup>
|
||||
<Target Name="BeforeBuild">
|
||||
<Delete Files="$(BaseIntermediateOutputPath)\project.assets.json" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -9,26 +9,26 @@ import * as vscode from 'vscode';
|
||||
import * as path from 'path';
|
||||
import { BuildHelper } from '../tools/buildHelper';
|
||||
import { TestContext, createContext } from './testContext';
|
||||
import { ProjectType } from 'mssql';
|
||||
|
||||
describe('BuildHelper: Build Helper tests', function (): void {
|
||||
|
||||
it('Should get correct build arguments', function (): void {
|
||||
it('Should get correct build arguments for legacy-style projects', function (): void {
|
||||
// update settings and validate
|
||||
const buildHelper = new BuildHelper();
|
||||
const resultArg = buildHelper.constructBuildArguments('dummy\\project path\\more space in path', 'dummy\\dll path', false);
|
||||
const resultArg = buildHelper.constructBuildArguments('dummy\\project path\\more space in path', 'dummy\\dll path', ProjectType.LegacyStyle);
|
||||
|
||||
if (os.platform() === 'win32') {
|
||||
should(resultArg).equal(' build "dummy\\\\project path\\\\more space in path" /p:NetCoreBuild=true /p:NETCoreTargetsPath="dummy\\\\dll path"');
|
||||
should(resultArg).equal(' build "dummy\\\\project path\\\\more space in path" /p:NetCoreBuild=true /p:NETCoreTargetsPath="dummy\\\\dll path" /p:SystemDacpacsLocation="dummy\\\\dll path"');
|
||||
}
|
||||
else {
|
||||
should(resultArg).equal(' build "dummy/project path/more space in path" /p:NetCoreBuild=true /p:NETCoreTargetsPath="dummy/dll path"');
|
||||
should(resultArg).equal(' build "dummy/project path/more space in path" /p:NetCoreBuild=true /p:NETCoreTargetsPath="dummy/dll path" /p:SystemDacpacsLocation="dummy/dll path"');
|
||||
}
|
||||
});
|
||||
|
||||
it('Should get correct build arguments for sdk style projects', function (): void {
|
||||
it('Should get correct build arguments for SDK-style projects', function (): void {
|
||||
// update settings and validate
|
||||
const buildHelper = new BuildHelper();
|
||||
const resultArg = buildHelper.constructBuildArguments('dummy\\project path\\more space in path', 'dummy\\dll path', true);
|
||||
const resultArg = buildHelper.constructBuildArguments('dummy\\project path\\more space in path', 'dummy\\dll path', ProjectType.SdkStyle);
|
||||
|
||||
if (os.platform() === 'win32') {
|
||||
should(resultArg).equal(' build "dummy\\\\project path\\\\more space in path" /p:NetCoreBuild=true /p:SystemDacpacsLocation="dummy\\\\dll path"');
|
||||
|
||||
@@ -10,16 +10,16 @@ import * as sql from '../models/dataSources/sqlConnectionStringSource';
|
||||
import * as dataSources from '../models/dataSources/dataSources';
|
||||
|
||||
describe('Data Sources: DataSource operations', function (): void {
|
||||
before(async function () : Promise<void> {
|
||||
before(async function (): Promise<void> {
|
||||
await baselines.loadBaselines();
|
||||
});
|
||||
|
||||
after(async function(): Promise<void> {
|
||||
after(async function (): Promise<void> {
|
||||
await testUtils.deleteGeneratedTestFolder();
|
||||
});
|
||||
|
||||
it.skip('Should read DataSources from datasource.json', async function (): Promise<void> {
|
||||
const dataSourcePath = await testUtils.createTestDataSources(baselines.openDataSourcesBaseline);
|
||||
const dataSourcePath = await testUtils.createTestDataSources(this.test, baselines.openDataSourcesBaseline);
|
||||
const dataSourceList = await dataSources.load(dataSourcePath);
|
||||
|
||||
should(dataSourceList.length).equal(3);
|
||||
@@ -36,7 +36,7 @@ describe('Data Sources: DataSource operations', function (): void {
|
||||
should((dataSourceList[2] as sql.SqlConnectionDataSource).azureMFA).equal(true);
|
||||
});
|
||||
|
||||
it ('Should be able to create sql data source from connection strings with and without ending semicolon', function (): void {
|
||||
it('Should be able to create sql data source from connection strings with and without ending semicolon', function (): void {
|
||||
should.doesNotThrow(() => new sql.SqlConnectionDataSource('no ending semicolon', 'Data Source=(LOCAL);Initial Catalog=testdb;User id=sa;Password=PLACEHOLDER'));
|
||||
should.doesNotThrow(() => new sql.SqlConnectionDataSource('ending in semicolon', 'Data Source=(LOCAL);Initial Catalog=testdb;User id=sa;Password=PLACEHOLDER;'));
|
||||
should.throws(() => new sql.SqlConnectionDataSource('invalid extra equals sign', 'Data Source=(LOCAL);Initial Catalog=testdb=extra;User id=sa;Password=PLACEHOLDER'));
|
||||
|
||||
@@ -70,7 +70,7 @@ describe('deploy service', function (): void {
|
||||
sandbox = sinon.createSandbox();
|
||||
});
|
||||
|
||||
after(async function(): Promise<void> {
|
||||
after(async function (): Promise<void> {
|
||||
await testUtils.deleteGeneratedTestFolder();
|
||||
});
|
||||
|
||||
@@ -93,7 +93,7 @@ describe('deploy service', function (): void {
|
||||
dockerBaseImageEula: ''
|
||||
}
|
||||
};
|
||||
const projFilePath = await testUtils.createTestSqlProjFile(baselines.newProjectFileBaseline);
|
||||
const projFilePath = await testUtils.createTestSqlProjFile(this.test, baselines.newProjectFileBaseline);
|
||||
const project1 = await Project.openProject(vscode.Uri.file(projFilePath).fsPath);
|
||||
const shellExecutionHelper = TypeMoq.Mock.ofType(ShellExecutionHelper);
|
||||
shellExecutionHelper.setup(x => x.runStreamedCommand(TypeMoq.It.isAny(),
|
||||
@@ -128,7 +128,7 @@ describe('deploy service', function (): void {
|
||||
dockerBaseImageEula: ''
|
||||
}
|
||||
};
|
||||
const projFilePath = await testUtils.createTestSqlProjFile(baselines.newProjectFileBaseline);
|
||||
const projFilePath = await testUtils.createTestSqlProjFile(this.test, baselines.newProjectFileBaseline);
|
||||
const project1 = await Project.openProject(vscode.Uri.file(projFilePath).fsPath);
|
||||
const shellExecutionHelper = TypeMoq.Mock.ofType(ShellExecutionHelper);
|
||||
shellExecutionHelper.setup(x => x.runStreamedCommand(TypeMoq.It.isAny(),
|
||||
|
||||
@@ -22,28 +22,38 @@ describe('Add Database Reference Dialog', () => {
|
||||
});
|
||||
|
||||
beforeEach(function (): void {
|
||||
const dataWorkspaceMock = TypeMoq.Mock.ofType<dataworkspace.IExtension>();
|
||||
dataWorkspaceMock.setup(x => x.getProjectsInWorkspace(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve([]));
|
||||
sinon.stub(vscode.extensions, 'getExtension').returns(<any>{ exports: dataWorkspaceMock.object });
|
||||
// const dataWorkspaceMock = TypeMoq.Mock.ofType<dataworkspace.IExtension>();
|
||||
// dataWorkspaceMock.setup(x => x.getProjectsInWorkspace(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve([]));
|
||||
// sinon.stub(vscode.extensions, 'getExtension').withArgs('Microsoft.data-workspace').returns(<any>{ exports: dataWorkspaceMock.object });
|
||||
});
|
||||
|
||||
afterEach(function (): void {
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
after(async function(): Promise<void> {
|
||||
after(async function (): Promise<void> {
|
||||
await testUtils.deleteGeneratedTestFolder();
|
||||
});
|
||||
|
||||
it('Should open dialog successfully', async function (): Promise<void> {
|
||||
const project = await testUtils.createTestProject(baselines.newProjectFileBaseline);
|
||||
const project = await testUtils.createTestProject(this.test, baselines.newProjectFileBaseline);
|
||||
|
||||
const dataWorkspaceMock = TypeMoq.Mock.ofType<dataworkspace.IExtension>();
|
||||
dataWorkspaceMock.setup(x => x.getProjectsInWorkspace(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve([]));
|
||||
sinon.stub(vscode.extensions, 'getExtension').withArgs('Microsoft.data-workspace').returns(<any>{ exports: dataWorkspaceMock.object });
|
||||
|
||||
const dialog = new AddDatabaseReferenceDialog(project);
|
||||
await dialog.openDialog();
|
||||
should.notEqual(dialog.addDatabaseReferenceTab, undefined);
|
||||
});
|
||||
|
||||
it('Should enable ok button correctly', async function (): Promise<void> {
|
||||
const project = await testUtils.createTestProject(baselines.newProjectFileBaseline);
|
||||
const project = await testUtils.createTestProject(this.test, baselines.newProjectFileBaseline);
|
||||
|
||||
const dataWorkspaceMock = TypeMoq.Mock.ofType<dataworkspace.IExtension>();
|
||||
dataWorkspaceMock.setup(x => x.getProjectsInWorkspace(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve([]));
|
||||
sinon.stub(vscode.extensions, 'getExtension').withArgs('Microsoft.data-workspace').returns(<any>{ exports: dataWorkspaceMock.object });
|
||||
|
||||
const dialog = new AddDatabaseReferenceDialog(project);
|
||||
await dialog.openDialog();
|
||||
|
||||
@@ -97,35 +107,40 @@ describe('Add Database Reference Dialog', () => {
|
||||
});
|
||||
|
||||
it('Should enable and disable input boxes depending on the reference type', async function (): Promise<void> {
|
||||
const project = await testUtils.createTestProject(baselines.newProjectFileBaseline);
|
||||
const project = await testUtils.createTestProject(this.test, baselines.newProjectFileBaseline);
|
||||
|
||||
const dataWorkspaceMock = TypeMoq.Mock.ofType<dataworkspace.IExtension>();
|
||||
dataWorkspaceMock.setup(x => x.getProjectsInWorkspace(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve([]));
|
||||
sinon.stub(vscode.extensions, 'getExtension').withArgs('Microsoft.data-workspace').returns(<any>{ exports: dataWorkspaceMock.object });
|
||||
|
||||
const dialog = new AddDatabaseReferenceDialog(project);
|
||||
await dialog.openDialog();
|
||||
|
||||
// dialog starts with system db because there aren't any other projects in the workspace
|
||||
should(dialog.currentReferenceType).equal(ReferenceType.systemDb);
|
||||
validateInputBoxEnabledStates(dialog, { databaseNameEnabled: true, databaseVariableEnabled: false, serverNameEnabled: false, serverVariabledEnabled: false});
|
||||
validateInputBoxEnabledStates(dialog, { databaseNameEnabled: true, databaseVariableEnabled: false, serverNameEnabled: false, serverVariabledEnabled: false });
|
||||
|
||||
// change to dacpac reference
|
||||
dialog.dacpacRadioButtonClick();
|
||||
should(dialog.currentReferenceType).equal(ReferenceType.dacpac);
|
||||
should(dialog.locationDropdown!.value).equal(constants.differentDbSameServer);
|
||||
validateInputBoxEnabledStates(dialog, { databaseNameEnabled: true, databaseVariableEnabled: true, serverNameEnabled: false, serverVariabledEnabled: false});
|
||||
validateInputBoxEnabledStates(dialog, { databaseNameEnabled: true, databaseVariableEnabled: true, serverNameEnabled: false, serverVariabledEnabled: false });
|
||||
|
||||
// change location to different db, different server
|
||||
dialog.locationDropdown!.value = constants.differentDbDifferentServer;
|
||||
dialog.updateEnabledInputBoxes();
|
||||
validateInputBoxEnabledStates(dialog, { databaseNameEnabled: true, databaseVariableEnabled: true, serverNameEnabled: true, serverVariabledEnabled: true});
|
||||
validateInputBoxEnabledStates(dialog, { databaseNameEnabled: true, databaseVariableEnabled: true, serverNameEnabled: true, serverVariabledEnabled: true });
|
||||
|
||||
// change location to same db
|
||||
dialog.locationDropdown!.value = constants.sameDatabase;
|
||||
dialog.updateEnabledInputBoxes();
|
||||
validateInputBoxEnabledStates(dialog, { databaseNameEnabled: false, databaseVariableEnabled: false, serverNameEnabled: false, serverVariabledEnabled: false});
|
||||
validateInputBoxEnabledStates(dialog, { databaseNameEnabled: false, databaseVariableEnabled: false, serverNameEnabled: false, serverVariabledEnabled: false });
|
||||
|
||||
// change to project reference
|
||||
dialog.projectRadioButtonClick();
|
||||
should(dialog.currentReferenceType).equal(ReferenceType.project);
|
||||
should(dialog.locationDropdown!.value).equal(constants.sameDatabase);
|
||||
validateInputBoxEnabledStates(dialog, { databaseNameEnabled: false, databaseVariableEnabled: false, serverNameEnabled: false, serverVariabledEnabled: false});
|
||||
validateInputBoxEnabledStates(dialog, { databaseNameEnabled: false, databaseVariableEnabled: false, serverNameEnabled: false, serverVariabledEnabled: false });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -139,6 +154,6 @@ interface inputBoxExpectedStates {
|
||||
function validateInputBoxEnabledStates(dialog: AddDatabaseReferenceDialog, expectedStates: inputBoxExpectedStates): void {
|
||||
should(dialog.databaseNameTextbox?.enabled).equal(expectedStates.databaseNameEnabled, `Database name text box should be ${expectedStates.databaseNameEnabled}. Actual: ${dialog.databaseNameTextbox?.enabled}`);
|
||||
should(dialog.databaseVariableTextbox?.enabled).equal(expectedStates.databaseVariableEnabled, `Database variable text box should be ${expectedStates.databaseVariableEnabled}. Actual: ${dialog.databaseVariableTextbox?.enabled}`);
|
||||
should(dialog.serverNameTextbox?.enabled).equal(expectedStates.serverNameEnabled, `Server name text box should be ${expectedStates.serverNameEnabled}. Actual: ${dialog.serverNameTextbox?.enabled}`);
|
||||
should(dialog.serverNameTextbox?.enabled).equal(expectedStates.serverNameEnabled, `Server name text box should be ${expectedStates.serverNameEnabled}. Actual: ${dialog.serverNameTextbox?.enabled}`);
|
||||
should(dialog.serverVariableTextbox?.enabled).equal(expectedStates.serverVariabledEnabled, `Server variable text box should be ${expectedStates.serverVariabledEnabled}. Actual: ${dialog.serverVariableTextbox?.enabled}`);
|
||||
}
|
||||
|
||||
@@ -155,9 +155,9 @@ describe('Create Project From Database Quickpick', () => {
|
||||
it('Should exit when folder structure is not selected and existing folder/file location is selected', async function (): Promise<void> {
|
||||
//create folder and project file
|
||||
const projectFileName = 'TestProject';
|
||||
const testProjectFilePath = await generateTestFolderPath();
|
||||
const testProjectFilePath = await generateTestFolderPath(this.test);
|
||||
await fs.rm(testProjectFilePath, { force: true, recursive: true }); //clean up if it already exists
|
||||
await createTestFile('', `${projectFileName}.sqlproj`, testProjectFilePath);
|
||||
await createTestFile(this.test, '', `${projectFileName}.sqlproj`, testProjectFilePath);
|
||||
|
||||
//user chooses connection and database
|
||||
sinon.stub(testUtils.vscodeMssqlIExtension.object, 'connect').resolves('testConnectionURI');
|
||||
|
||||
@@ -26,13 +26,13 @@ describe('Publish Database Dialog', () => {
|
||||
testContext = createContext();
|
||||
});
|
||||
|
||||
after(async function(): Promise<void> {
|
||||
after(async function (): Promise<void> {
|
||||
await testUtils.deleteGeneratedTestFolder();
|
||||
});
|
||||
|
||||
it('Should open dialog successfully ', async function (): Promise<void> {
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
const projFileDir = path.join(testUtils.generateBaseFolderName(), `TestProject_${new Date().getTime()}`);
|
||||
const projFileDir = await testUtils.generateTestFolderPath(this.test);
|
||||
|
||||
const projFilePath = await projController.createNewProject({
|
||||
newProjName: 'TestProjectName',
|
||||
@@ -50,8 +50,7 @@ describe('Publish Database Dialog', () => {
|
||||
|
||||
it('Should create default database name correctly ', async function (): Promise<void> {
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
const projFolder = `TestProject_${new Date().getTime()}`;
|
||||
const projFileDir = path.join(testUtils.generateBaseFolderName(), projFolder);
|
||||
const projFileDir = await testUtils.generateTestFolderPath(this.test);
|
||||
|
||||
const projFilePath = await projController.createNewProject({
|
||||
newProjName: 'TestProjectName',
|
||||
@@ -68,7 +67,7 @@ describe('Publish Database Dialog', () => {
|
||||
});
|
||||
|
||||
it('Should include all info in publish profile', async function (): Promise<void> {
|
||||
const proj = await testUtils.createTestProject(baselines.openProjectFileBaseline);
|
||||
const proj = await testUtils.createTestProject(this.test, baselines.openProjectFileBaseline);
|
||||
const dialog = TypeMoq.Mock.ofType(PublishDatabaseDialog, undefined, undefined, proj);
|
||||
dialog.setup(x => x.getConnectionUri()).returns(() => { return Promise.resolve('Mock|Connection|Uri'); });
|
||||
dialog.setup(x => x.targetDatabaseName).returns(() => 'MockDatabaseName');
|
||||
|
||||
@@ -19,7 +19,7 @@ describe('Publish Database Options Dialog', () => {
|
||||
await baselines.loadBaselines();
|
||||
});
|
||||
|
||||
after(async function(): Promise<void> {
|
||||
after(async function (): Promise<void> {
|
||||
await testUtils.deleteGeneratedTestFolder();
|
||||
});
|
||||
|
||||
@@ -36,7 +36,7 @@ describe('Publish Database Options Dialog', () => {
|
||||
|
||||
it('Should deployment options gets initialized correctly with sample test project', async function (): Promise<void> {
|
||||
// Create new sample test project
|
||||
const project = await testUtils.createTestProject(baselines.openProjectFileBaseline);
|
||||
const project = await testUtils.createTestProject(this.test, baselines.openProjectFileBaseline);
|
||||
const dialog = TypeMoq.Mock.ofType(PublishDatabaseDialog, undefined, undefined, project);
|
||||
|
||||
dialog.setup(x => x.getDeploymentOptions()).returns(() => { return Promise.resolve(testData.mockDacFxOptionsResult.deploymentOptions); });
|
||||
|
||||
@@ -36,7 +36,7 @@ describe('Update Project From Database Dialog', () => {
|
||||
});
|
||||
|
||||
it('Should populate endpoints correctly when Project context is passed', async function (): Promise<void> {
|
||||
const project = await testUtils.createTestProject(baselines.openProjectFileBaseline);
|
||||
const project = await testUtils.createTestProject(this.test, baselines.openProjectFileBaseline);
|
||||
const dialog = new UpdateProjectFromDatabaseDialog(undefined, project, mockURIList);
|
||||
await dialog.openDialog();
|
||||
|
||||
@@ -62,7 +62,7 @@ describe('Update Project From Database Dialog', () => {
|
||||
});
|
||||
|
||||
it('Should populate endpoints correctly when context is complete', async function (): Promise<void> {
|
||||
const project = await testUtils.createTestProject(baselines.openProjectFileBaseline);
|
||||
const project = await testUtils.createTestProject(this.test, baselines.openProjectFileBaseline);
|
||||
sinon.stub(azdata.connection, 'getConnections').resolves([<azdata.connection.ConnectionProfile><unknown>mockConnectionProfile]);
|
||||
sinon.stub(azdata.connection, 'listDatabases').resolves([mockConnectionProfile.databaseName!]);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ describe('NetCoreTool: Net core tests', function (): void {
|
||||
testContext = createContext();
|
||||
});
|
||||
|
||||
after(async function(): Promise<void> {
|
||||
after(async function (): Promise<void> {
|
||||
await deleteGeneratedTestFolder();
|
||||
});
|
||||
|
||||
@@ -55,7 +55,7 @@ describe('NetCoreTool: Net core tests', function (): void {
|
||||
should(result).true('dotnet not present in programfiles by default');
|
||||
}
|
||||
|
||||
if (os.platform() === 'linux'){
|
||||
if (os.platform() === 'linux') {
|
||||
//check that path should start with /usr/share
|
||||
let result = !netcoreTool.netcoreInstallLocation || netcoreTool.netcoreInstallLocation.toLowerCase() === '/usr/share/dotnet';
|
||||
should(result).true('dotnet not present in /usr/share');
|
||||
@@ -70,7 +70,7 @@ describe('NetCoreTool: Net core tests', function (): void {
|
||||
|
||||
it('should run a command successfully', async function (): Promise<void> {
|
||||
const netcoreTool = new NetCoreTool(testContext.outputChannel);
|
||||
const dummyFile = path.join(await generateTestFolderPath(), 'dummy.dacpac');
|
||||
const dummyFile = path.join(await generateTestFolderPath(this.test), 'dummy.dacpac');
|
||||
|
||||
try {
|
||||
await netcoreTool.runStreamedCommand('echo test > ' + getQuotedPath(dummyFile), undefined);
|
||||
|
||||
@@ -11,25 +11,25 @@ import * as dataworkspace from 'dataworkspace';
|
||||
import * as newProjectTool from '../tools/newProjectTool';
|
||||
import { generateTestFolderPath, createTestFile, deleteGeneratedTestFolder } from './testUtils';
|
||||
|
||||
let previousSetting : string;
|
||||
let testFolderPath : string;
|
||||
let previousSetting: string;
|
||||
let testFolderPath: string;
|
||||
|
||||
describe('NewProjectTool: New project tool tests', function (): void {
|
||||
const projectConfigurationKey = 'projects';
|
||||
const projectSaveLocationKey= 'defaultProjectSaveLocation';
|
||||
const projectSaveLocationKey = 'defaultProjectSaveLocation';
|
||||
|
||||
beforeEach(async function () {
|
||||
previousSetting = await vscode.workspace.getConfiguration(projectConfigurationKey)[projectSaveLocationKey];
|
||||
testFolderPath = await generateTestFolderPath();
|
||||
testFolderPath = await generateTestFolderPath(this.test);
|
||||
// set the default project folder path to the test folder
|
||||
await vscode.workspace.getConfiguration(projectConfigurationKey).update(projectSaveLocationKey, testFolderPath, true);
|
||||
|
||||
const dataWorkspaceMock = TypeMoq.Mock.ofType<dataworkspace.IExtension>();
|
||||
dataWorkspaceMock.setup(x => x.defaultProjectSaveLocation).returns(() => vscode.Uri.file(testFolderPath));
|
||||
sinon.stub(vscode.extensions, 'getExtension').returns(<any>{ exports: dataWorkspaceMock.object});
|
||||
sinon.stub(vscode.extensions, 'getExtension').returns(<any>{ exports: dataWorkspaceMock.object });
|
||||
});
|
||||
|
||||
after(async function(): Promise<void> {
|
||||
after(async function (): Promise<void> {
|
||||
await deleteGeneratedTestFolder();
|
||||
});
|
||||
|
||||
@@ -47,20 +47,20 @@ describe('NewProjectTool: New project tool tests', function (): void {
|
||||
it('Should auto-increment default project names for new projects', async function (): Promise<void> {
|
||||
should(newProjectTool.defaultProjectNameNewProj()).equal('DatabaseProject1');
|
||||
|
||||
await createTestFile('', 'DatabaseProject1', testFolderPath);
|
||||
await createTestFile(this.test, '', 'DatabaseProject1', testFolderPath);
|
||||
should(newProjectTool.defaultProjectNameNewProj()).equal('DatabaseProject2');
|
||||
|
||||
await createTestFile('', 'DatabaseProject2', testFolderPath);
|
||||
await createTestFile(this.test, '', 'DatabaseProject2', testFolderPath);
|
||||
should(newProjectTool.defaultProjectNameNewProj()).equal('DatabaseProject3');
|
||||
});
|
||||
|
||||
it('Should auto-increment default project names for create project for database', async function (): Promise<void> {
|
||||
should(newProjectTool.defaultProjectNameFromDb('master')).equal('DatabaseProjectmaster');
|
||||
|
||||
await createTestFile('', 'DatabaseProjectmaster', testFolderPath);
|
||||
await createTestFile(this.test, '', 'DatabaseProjectmaster', testFolderPath);
|
||||
should(newProjectTool.defaultProjectNameFromDb('master')).equal('DatabaseProjectmaster2');
|
||||
|
||||
await createTestFile('', 'DatabaseProjectmaster2', testFolderPath);
|
||||
await createTestFile(this.test, '', 'DatabaseProjectmaster2', testFolderPath);
|
||||
should(newProjectTool.defaultProjectNameFromDb('master')).equal('DatabaseProjectmaster3');
|
||||
});
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,7 @@ import { SqlDatabaseProjectTreeViewProvider } from '../controllers/databaseProje
|
||||
import { ProjectsController } from '../controllers/projectController';
|
||||
import { promises as fs } from 'fs';
|
||||
import { createContext, TestContext, mockDacFxResult, mockConnectionProfile } from './testContext';
|
||||
import { Project, reservedProjectFolders } from '../models/project';
|
||||
import { Project } from '../models/project';
|
||||
import { PublishDatabaseDialog } from '../dialogs/publishDatabaseDialog';
|
||||
import { ProjectRootTreeItem } from '../models/tree/projectTreeItem';
|
||||
import { FolderNode, FileNode } from '../models/tree/fileFolderTreeItem';
|
||||
@@ -30,7 +30,8 @@ import { IDacpacReferenceSettings } from '../models/IDatabaseReferenceSettings';
|
||||
import { CreateProjectFromDatabaseDialog } from '../dialogs/createProjectFromDatabaseDialog';
|
||||
import { ImportDataModel } from '../models/api/import';
|
||||
import { EntryType, ItemType, SqlTargetPlatform } from 'sqldbproj';
|
||||
import { SystemDatabaseReferenceProjectEntry, SystemDatabase, FileProjectEntry } from '../models/projectEntry';
|
||||
import { FileProjectEntry } from '../models/projectEntry';
|
||||
import { SystemDatabase } from 'mssql';
|
||||
|
||||
let testContext: TestContext;
|
||||
|
||||
@@ -56,7 +57,7 @@ describe('ProjectsController', function (): void {
|
||||
describe('Project file operations and prompting', function (): void {
|
||||
it('Should create new sqlproj file with correct specified target platform', async function (): Promise<void> {
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
const projFileDir = path.join(testUtils.generateBaseFolderName(), `TestProject_${new Date().getTime()}`);
|
||||
const projFileDir = await testUtils.generateTestFolderPath(this.test);
|
||||
const projTargetPlatform = SqlTargetPlatform.sqlAzure; // default is SQL Server 2022
|
||||
|
||||
const projFilePath = await projController.createNewProject({
|
||||
@@ -75,7 +76,7 @@ describe('ProjectsController', function (): void {
|
||||
|
||||
it('Should create new edge project with expected template files', async function (): Promise<void> {
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
const projFileDir = path.join(testUtils.generateBaseFolderName(), `TestProject_${new Date().getTime()}`);
|
||||
const projFileDir = await testUtils.generateTestFolderPath(this.test);
|
||||
|
||||
const projFilePath = await projController.createNewProject({
|
||||
newProjName: 'TestProjectName',
|
||||
@@ -111,7 +112,7 @@ describe('ProjectsController', function (): void {
|
||||
sinon.stub(utils, 'sanitizeStringForFilename').returns(tableName);
|
||||
const spy = sinon.spy(vscode.window, 'showErrorMessage');
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
let project = await testUtils.createTestProject(baselines.newProjectFileBaseline);
|
||||
let project = await testUtils.createTestProject(this.test, baselines.newProjectFileBaseline);
|
||||
|
||||
should(project.files.length).equal(0, 'There should be no files');
|
||||
await projController.addItemPrompt(project, '', { itemType: ItemType.script });
|
||||
@@ -127,7 +128,7 @@ describe('ProjectsController', function (): void {
|
||||
sinon.stub(vscode.window, 'showQuickPick').resolves(undefined);
|
||||
const spy = sinon.spy(vscode.window, 'showErrorMessage');
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
const project = await testUtils.createTestProject(baselines.newProjectFileBaseline);
|
||||
const project = await testUtils.createTestProject(this.test, baselines.newProjectFileBaseline);
|
||||
|
||||
should(project.files.length).equal(0, 'There should be no files');
|
||||
await projController.addItemPrompt(project, '');
|
||||
@@ -141,7 +142,7 @@ describe('ProjectsController', function (): void {
|
||||
sinon.stub(utils, 'sanitizeStringForFilename').returns(tableName);
|
||||
const spy = sinon.spy(vscode.window, 'showErrorMessage');
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
let project = await testUtils.createTestProject(baselines.newProjectFileBaseline);
|
||||
let project = await testUtils.createTestProject(this.test, baselines.newProjectFileBaseline);
|
||||
|
||||
should(project.files.length).equal(0, 'There should be no files');
|
||||
await projController.addItemPrompt(project, '', { itemType: ItemType.script });
|
||||
@@ -171,22 +172,22 @@ describe('ProjectsController', function (): void {
|
||||
sinon.stub(utils, 'sanitizeStringForFilename').returns(folderName);
|
||||
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
let project = await testUtils.createTestProject(baselines.newProjectFileBaseline);
|
||||
let project = await testUtils.createTestProject(this.test, baselines.newProjectFileBaseline);
|
||||
const projectRoot = new ProjectRootTreeItem(project);
|
||||
|
||||
should(project.files.length).equal(0, 'There should be no other folders');
|
||||
should(project.folders.length).equal(0, 'There should be no other folders');
|
||||
await projController.addFolderPrompt(createWorkspaceTreeItem(projectRoot));
|
||||
|
||||
// reload project
|
||||
project = await Project.openProject(project.projectFilePath);
|
||||
|
||||
should(project.files.length).equal(1, 'Folder should be successfully added');
|
||||
should(project.folders.length).equal(1, 'Folder should be successfully added');
|
||||
stub.restore();
|
||||
await verifyFolderNotAdded(folderName, projController, project, projectRoot);
|
||||
|
||||
// reserved folder names
|
||||
for (let i in reservedProjectFolders) {
|
||||
await verifyFolderNotAdded(reservedProjectFolders[i], projController, project, projectRoot);
|
||||
for (let i in constants.reservedProjectFolders) {
|
||||
await verifyFolderNotAdded(constants.reservedProjectFolders[i], projController, project, projectRoot);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -196,47 +197,48 @@ describe('ProjectsController', function (): void {
|
||||
sinon.stub(utils, 'sanitizeStringForFilename').returns(folderName);
|
||||
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
let project = await testUtils.createTestProject(baselines.openProjectFileBaseline);
|
||||
let project = await testUtils.createTestProject(this.test, baselines.openProjectFileBaseline);
|
||||
const projectRoot = new ProjectRootTreeItem(project);
|
||||
|
||||
// make sure it's ok to add these folders if they aren't where the reserved folders are at the root of the project
|
||||
let node = projectRoot.children.find(c => c.friendlyName === 'Tables');
|
||||
sinon.restore();
|
||||
for (let i in reservedProjectFolders) {
|
||||
for (let i in constants.reservedProjectFolders) {
|
||||
// reload project
|
||||
project = await Project.openProject(project.projectFilePath);
|
||||
await verifyFolderAdded(reservedProjectFolders[i], projController, project, <BaseProjectTreeItem>node);
|
||||
await verifyFolderAdded(constants.reservedProjectFolders[i], projController, project, <BaseProjectTreeItem>node);
|
||||
}
|
||||
});
|
||||
|
||||
async function verifyFolderAdded(folderName: string, projController: ProjectsController, project: Project, node: BaseProjectTreeItem): Promise<void> {
|
||||
const beforeFileCount = project.files.length;
|
||||
let beforeFiles = project.files.map(f => f.relativePath);
|
||||
const beforeFolderCount = project.folders.length;
|
||||
let beforeFolders = project.folders.map(f => f.relativePath);
|
||||
sinon.stub(vscode.window, 'showInputBox').resolves(folderName);
|
||||
sinon.stub(utils, 'sanitizeStringForFilename').returns(folderName);
|
||||
await projController.addFolderPrompt(createWorkspaceTreeItem(node));
|
||||
|
||||
// reload project
|
||||
project = await Project.openProject(project.projectFilePath);
|
||||
should(project.files.length).equal(beforeFileCount + 1, `File count should be increased by one after adding the folder ${folderName}. before files: ${JSON.stringify(beforeFiles)}/n after files: ${JSON.stringify(project.files.map(f => f.relativePath))}`);
|
||||
should(project.folders.length).equal(beforeFolderCount + 1, `Folder count should be increased by one after adding the folder ${folderName}. before folders: ${JSON.stringify(beforeFolders)}/n after folders: ${JSON.stringify(project.files.map(f => f.relativePath))}`);
|
||||
sinon.restore();
|
||||
}
|
||||
|
||||
async function verifyFolderNotAdded(folderName: string, projController: ProjectsController, project: Project, node: BaseProjectTreeItem): Promise<void> {
|
||||
const beforeFileCount = project.files.length;
|
||||
const beforeFileCount = project.folders.length;
|
||||
const showInputBoxStub = sinon.stub(vscode.window, 'showInputBox').resolves(folderName);
|
||||
const showErrorMessageSpy = sinon.spy(vscode.window, 'showErrorMessage');
|
||||
await projController.addFolderPrompt(createWorkspaceTreeItem(node));
|
||||
should(showErrorMessageSpy.calledOnce).be.true('showErrorMessage should have been called exactly once');
|
||||
const msg = constants.folderAlreadyExists(folderName);
|
||||
should(showErrorMessageSpy.calledWith(msg)).be.true(`showErrorMessage not called with expected message '${msg}' Actual '${showErrorMessageSpy.getCall(0).args[0]}'`);
|
||||
should(project.files.length).equal(beforeFileCount, 'File count should be the same as before the folder was attempted to be added');
|
||||
should(project.folders.length).equal(beforeFileCount, 'File count should be the same as before the folder was attempted to be added');
|
||||
showInputBoxStub.restore();
|
||||
showErrorMessageSpy.restore();
|
||||
}
|
||||
|
||||
it('Should delete nested ProjectEntry from node', async function (): Promise<void> {
|
||||
let proj = await testUtils.createTestProject(templates.newSqlProjectTemplate);
|
||||
// TODO: move test to DacFx and fix delete
|
||||
it.skip('Should delete nested ProjectEntry from node', async function (): Promise<void> {
|
||||
let proj = await testUtils.createTestProject(this.test, templates.newSqlProjectTemplate);
|
||||
|
||||
const setupResult = await setupDeleteExcludeTest(proj);
|
||||
const scriptEntry = setupResult[0], projTreeRoot = setupResult[1], preDeployEntry = setupResult[2], postDeployEntry = setupResult[3], noneEntry = setupResult[4];
|
||||
@@ -252,11 +254,11 @@ describe('ProjectsController', function (): void {
|
||||
proj = await Project.openProject(proj.projectFilePath); // reload edited sqlproj from disk
|
||||
|
||||
// confirm result
|
||||
should(proj.files.length).equal(1, 'number of file/folder entries'); // lowerEntry and the contained scripts should be deleted
|
||||
should(proj.files[0].relativePath).equal('UpperFolder\\');
|
||||
should(proj.preDeployScripts.length).equal(0);
|
||||
should(proj.postDeployScripts.length).equal(0);
|
||||
should(proj.noneDeployScripts.length).equal(0);
|
||||
should(proj.files.length).equal(3, 'number of file entries'); // lowerEntry and the contained scripts should be deleted
|
||||
should(proj.folders[0].relativePath).equal('UpperFolder');
|
||||
should(proj.preDeployScripts.length).equal(0, 'Pre Deployment scripts should have been deleted');
|
||||
should(proj.postDeployScripts.length).equal(0, 'Post Deployment scripts should have been deleted');
|
||||
should(proj.noneDeployScripts.length).equal(0, 'None file should have been deleted');
|
||||
|
||||
should(await utils.exists(scriptEntry.fsUri.fsPath)).equal(false, 'script is supposed to be deleted');
|
||||
should(await utils.exists(preDeployEntry.fsUri.fsPath)).equal(false, 'pre-deployment script is supposed to be deleted');
|
||||
@@ -266,7 +268,7 @@ describe('ProjectsController', function (): void {
|
||||
|
||||
it('Should delete database references', async function (): Promise<void> {
|
||||
// setup - openProject baseline has a system db reference to master
|
||||
let proj = await testUtils.createTestProject(baselines.openProjectFileBaseline);
|
||||
let proj = await testUtils.createTestProject(this.test, baselines.openProjectFileBaseline);
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
sinon.stub(vscode.window, 'showWarningMessage').returns(<any>Promise.resolve(constants.yesString));
|
||||
|
||||
@@ -277,6 +279,7 @@ describe('ProjectsController', function (): void {
|
||||
databaseVariable: 'test2Db',
|
||||
suppressMissingDependenciesErrors: false
|
||||
});
|
||||
|
||||
// add project reference
|
||||
await proj.addProjectReference({
|
||||
projectName: 'project1',
|
||||
@@ -286,8 +289,6 @@ describe('ProjectsController', function (): void {
|
||||
});
|
||||
|
||||
const projTreeRoot = new ProjectRootTreeItem(proj);
|
||||
// reload project
|
||||
proj = await Project.openProject(proj.projectFilePath);
|
||||
should(proj.databaseReferences.length).equal(3, 'Should start with 3 database references');
|
||||
|
||||
const databaseReferenceNodeChildren = projTreeRoot.children.find(x => x.friendlyName === constants.databaseReferencesNodeName)?.children;
|
||||
@@ -302,7 +303,7 @@ describe('ProjectsController', function (): void {
|
||||
});
|
||||
|
||||
it('Should exclude nested ProjectEntry from node', async function (): Promise<void> {
|
||||
let proj = await testUtils.createTestProject(templates.newSqlProjectTemplate);
|
||||
let proj = await testUtils.createTestProject(this.test, templates.newSqlProjectTemplate);
|
||||
const setupResult = await setupDeleteExcludeTest(proj);
|
||||
const scriptEntry = setupResult[0], projTreeRoot = setupResult[1], preDeployEntry = setupResult[2], postDeployEntry = setupResult[3], noneEntry = setupResult[4];
|
||||
|
||||
@@ -317,11 +318,11 @@ describe('ProjectsController', function (): void {
|
||||
proj = await Project.openProject(proj.projectFilePath); // reload edited sqlproj from disk
|
||||
|
||||
// confirm result
|
||||
should(proj.files.length).equal(1, 'number of file/folder entries'); // LowerFolder and the contained scripts should be deleted
|
||||
should(proj.files[0].relativePath).equal('UpperFolder\\'); // UpperFolder should still be there
|
||||
should(proj.preDeployScripts.length).equal(0);
|
||||
should(proj.postDeployScripts.length).equal(0);
|
||||
should(proj.noneDeployScripts.length).equal(0);
|
||||
should(proj.files.length).equal(2, 'number of file entries'); // LowerFolder and the contained scripts should be deleted
|
||||
should(proj.folders.find(f => f.relativePath === 'UpperFolder')).not.equal(undefined, 'UpperFolder should still be there');
|
||||
should(proj.preDeployScripts.length).equal(0, 'Pre deployment scripts');
|
||||
should(proj.postDeployScripts.length).equal(0, 'Post deployment scripts');
|
||||
should(proj.noneDeployScripts.length).equal(0, 'None files');
|
||||
|
||||
should(await utils.exists(scriptEntry.fsUri.fsPath)).equal(true, 'script is supposed to still exist on disk');
|
||||
should(await utils.exists(preDeployEntry.fsUri.fsPath)).equal(true, 'pre-deployment script is supposed to still exist on disk');
|
||||
@@ -329,8 +330,9 @@ describe('ProjectsController', function (): void {
|
||||
should(await utils.exists(noneEntry.fsUri.fsPath)).equal(true, 'none entry pre-deployment script is supposed to still exist on disk');
|
||||
});
|
||||
|
||||
it('Should delete folders with excluded items', async function (): Promise<void> {
|
||||
let proj = await testUtils.createTestProject(templates.newSqlProjectTemplate);
|
||||
// TODO: move test to DacFx and fix delete
|
||||
it.skip('Should delete folders with excluded items', async function (): Promise<void> {
|
||||
let proj = await testUtils.createTestProject(this.test, templates.newSqlProjectTemplate);
|
||||
const setupResult = await setupDeleteExcludeTest(proj);
|
||||
|
||||
const scriptEntry = setupResult[0], projTreeRoot = setupResult[1];
|
||||
@@ -358,8 +360,8 @@ describe('ProjectsController', function (): void {
|
||||
|
||||
it('Should reload correctly after changing sqlproj file', async function (): Promise<void> {
|
||||
// create project
|
||||
const folderPath = await testUtils.generateTestFolderPath();
|
||||
const sqlProjPath = await testUtils.createTestSqlProjFile(baselines.newProjectFileBaseline, folderPath);
|
||||
const folderPath = await testUtils.generateTestFolderPath(this.test);
|
||||
const sqlProjPath = await testUtils.createTestSqlProjFile(this.test, baselines.newProjectFileBaseline, folderPath);
|
||||
const treeProvider = new SqlDatabaseProjectTreeViewProvider();
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
let project = await Project.openProject(vscode.Uri.file(sqlProjPath).fsPath);
|
||||
@@ -375,7 +377,7 @@ describe('ProjectsController', function (): void {
|
||||
// calling this because this gets called in the projectProvider.getProjectTreeDataProvider(), which is called by workspaceTreeDataProvider
|
||||
// when notifyTreeDataChanged() happens
|
||||
// reload project
|
||||
project = await Project.openProject(sqlProjPath);
|
||||
project = await Project.openProject(sqlProjPath, false, true);
|
||||
treeProvider.load([project]);
|
||||
|
||||
// check that the new project is in the tree
|
||||
@@ -388,7 +390,7 @@ describe('ProjectsController', function (): void {
|
||||
const postDeployScriptName = 'PostDeployScript1.sql';
|
||||
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
const project = await testUtils.createTestProject(baselines.newProjectFileBaseline);
|
||||
const project = await testUtils.createTestProject(this.test, baselines.newProjectFileBaseline);
|
||||
|
||||
sinon.stub(vscode.window, 'showInputBox').resolves(preDeployScriptName);
|
||||
sinon.stub(utils, 'sanitizeStringForFilename').returns(preDeployScriptName);
|
||||
@@ -408,18 +410,13 @@ describe('ProjectsController', function (): void {
|
||||
sinon.stub(vscode.window, 'showQuickPick').resolves({ label: SqlTargetPlatform.sqlAzure });
|
||||
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
const sqlProjPath = await testUtils.createTestSqlProjFile(baselines.openProjectFileBaseline);
|
||||
const sqlProjPath = await testUtils.createTestSqlProjFile(this.test, baselines.openProjectFileBaseline);
|
||||
const project = await Project.openProject(sqlProjPath);
|
||||
should(project.getProjectTargetVersion()).equal(constants.targetPlatformToVersion.get(SqlTargetPlatform.sqlServer2019));
|
||||
should(project.databaseReferences.length).equal(1, 'Project should have one database reference to master');
|
||||
should(project.databaseReferences[0].fsUri.fsPath).containEql(constants.targetPlatformToVersion.get(SqlTargetPlatform.sqlServer2019));
|
||||
should((<SystemDatabaseReferenceProjectEntry>project.databaseReferences[0]).ssdtUri.fsPath).containEql(constants.targetPlatformToVersion.get(SqlTargetPlatform.sqlServer2019));
|
||||
|
||||
await projController.changeTargetPlatform(project);
|
||||
should(project.getProjectTargetVersion()).equal(constants.targetPlatformToVersion.get(SqlTargetPlatform.sqlAzure));
|
||||
// verify system db reference got updated too
|
||||
should(project.databaseReferences[0].fsUri.fsPath).containEql(constants.targetPlatformToVersion.get(SqlTargetPlatform.sqlAzure));
|
||||
should((<SystemDatabaseReferenceProjectEntry>project.databaseReferences[0]).ssdtUri.fsPath).containEql(constants.targetPlatformToVersion.get(SqlTargetPlatform.sqlAzure));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -440,9 +437,9 @@ describe('ProjectsController', function (): void {
|
||||
});
|
||||
|
||||
it('Callbacks are hooked up and called from Publish dialog', async function (): Promise<void> {
|
||||
const projectFile = await testUtils.createTestSqlProjFile(baselines.openProjectFileBaseline)
|
||||
const projectFile = await testUtils.createTestSqlProjFile(this.test, baselines.openProjectFileBaseline)
|
||||
const projFolder = path.dirname(projectFile);
|
||||
await testUtils.createTestDataSources(baselines.openDataSourcesBaseline, projFolder);
|
||||
await testUtils.createTestDataSources(this.test, baselines.openDataSourcesBaseline, projFolder);
|
||||
const proj = await Project.openProject(projectFile);
|
||||
|
||||
const publishHoller = 'hello from callback for publish()';
|
||||
@@ -501,12 +498,12 @@ describe('ProjectsController', function (): void {
|
||||
projController.callBase = true;
|
||||
|
||||
projController.setup(x => x.buildProject(TypeMoq.It.isAny())).returns(async () => {
|
||||
builtDacpacPath = await testUtils.createTestFile(fakeDacpacContents, 'output.dacpac');
|
||||
builtDacpacPath = await testUtils.createTestFile(this.test, fakeDacpacContents, 'output.dacpac');
|
||||
return builtDacpacPath;
|
||||
});
|
||||
sinon.stub(utils, 'getDacFxService').resolves(testContext.dacFxService.object);
|
||||
|
||||
const proj = await testUtils.createTestProject(baselines.openProjectFileBaseline);
|
||||
const proj = await testUtils.createTestProject(this.test, baselines.openProjectFileBaseline);
|
||||
|
||||
await projController.object.publishOrScriptProject(proj, { connectionUri: '', databaseName: '', serverName: '' }, false);
|
||||
|
||||
@@ -525,23 +522,26 @@ describe('ProjectsController', function (): void {
|
||||
});
|
||||
|
||||
it('Should create list of all files and folders correctly', async function (): Promise<void> {
|
||||
const testFolderPath = await testUtils.createDummyFileStructure();
|
||||
// dummy structure is 2 files (one .sql, one .txt) under parent folder + 2 directories with 5 .sql scripts each
|
||||
const testFolderPath = await testUtils.createDummyFileStructure(this.test);
|
||||
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
const fileList = await projController.generateList(testFolderPath);
|
||||
const fileList = await projController.generateScriptList(testFolderPath);
|
||||
|
||||
should(fileList.length).equal(15); // Parent folder + 2 files under parent folder + 2 directories with 5 files each
|
||||
// script list should only include the .sql files, no folders and not the .txt file
|
||||
(fileList.length).should.equal(11, 'number of files returned by generateScriptList()');
|
||||
(fileList.filter(x => path.extname(x.fsPath) !== constants.sqlFileExtension).length).should.equal(0, 'number of non-.sql files');
|
||||
});
|
||||
|
||||
it('Should error out for inaccessible path', async function (): Promise<void> {
|
||||
const spy = sinon.spy(vscode.window, 'showErrorMessage');
|
||||
|
||||
let testFolderPath = await testUtils.generateTestFolderPath();
|
||||
let testFolderPath = await testUtils.generateTestFolderPath(this.test);
|
||||
testFolderPath += '_nonexistentFolder'; // Modify folder path to point to a nonexistent location
|
||||
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
|
||||
await projController.generateList(testFolderPath);
|
||||
await projController.generateScriptList(testFolderPath);
|
||||
should(spy.calledOnce).be.true('showErrorMessage should have been called');
|
||||
const msg = constants.cannotResolvePath(testFolderPath);
|
||||
should(spy.calledWith(msg)).be.true(`showErrorMessage not called with expected message '${msg}' Actual '${spy.getCall(0).args[0]}'`);
|
||||
@@ -597,7 +597,7 @@ describe('ProjectsController', function (): void {
|
||||
});
|
||||
|
||||
it('Should set model filePath correctly for ExtractType = File', async function (): Promise<void> {
|
||||
let folderPath = await testUtils.generateTestFolderPath();
|
||||
let folderPath = await testUtils.generateTestFolderPath(this.test);
|
||||
let projectName = 'My Project';
|
||||
let importPath;
|
||||
let model: ImportDataModel = { connectionUri: 'My Id', database: 'My Database', projName: projectName, filePath: folderPath, version: '1.0.0.0', extractTarget: mssql.ExtractTarget['file'], sdkStyle: false };
|
||||
@@ -610,7 +610,7 @@ describe('ProjectsController', function (): void {
|
||||
});
|
||||
|
||||
it('Should set model filePath correctly for ExtractType = Schema/Object Type', async function (): Promise<void> {
|
||||
let folderPath = await testUtils.generateTestFolderPath();
|
||||
let folderPath = await testUtils.generateTestFolderPath(this.test);
|
||||
let projectName = 'My Project';
|
||||
let importPath;
|
||||
let model: ImportDataModel = { connectionUri: 'My Id', database: 'My Database', projName: projectName, filePath: folderPath, version: '1.0.0.0', extractTarget: mssql.ExtractTarget['schemaObjectType'], sdkStyle: false };
|
||||
@@ -639,7 +639,7 @@ describe('ProjectsController', function (): void {
|
||||
});
|
||||
|
||||
it('Callbacks are hooked up and called from Add database reference dialog', async function (): Promise<void> {
|
||||
const projPath = path.dirname(await testUtils.createTestSqlProjFile(baselines.openProjectFileBaseline));
|
||||
const projPath = path.dirname(await testUtils.createTestSqlProjFile(this.test, baselines.openProjectFileBaseline));
|
||||
const proj = new Project(projPath);
|
||||
|
||||
const addDbRefHoller = 'hello from callback for addDatabaseReference()';
|
||||
@@ -650,7 +650,7 @@ describe('ProjectsController', function (): void {
|
||||
addDbReferenceDialog.callBase = true;
|
||||
addDbReferenceDialog.setup(x => x.addReferenceClick()).returns(() => {
|
||||
return projController.object.addDatabaseReferenceCallback(proj,
|
||||
{ systemDb: SystemDatabase.master, databaseName: 'master', suppressMissingDependenciesErrors: false },
|
||||
{ systemDb: SystemDatabase.Master, databaseName: 'master', suppressMissingDependenciesErrors: false },
|
||||
{ treeDataProvider: new SqlDatabaseProjectTreeViewProvider(), element: undefined });
|
||||
});
|
||||
addDbReferenceDialog.setup(x => x.openDialog()).returns(() => Promise.resolve());
|
||||
@@ -669,9 +669,9 @@ describe('ProjectsController', function (): void {
|
||||
should(holler).equal(addDbRefHoller, 'executionCallback() is supposed to have been setup and called for add database reference scenario');
|
||||
});
|
||||
|
||||
it('Should not allow adding circular project references', async function (): Promise<void> {
|
||||
const projPath1 = await testUtils.createTestSqlProjFile(baselines.openProjectFileBaseline);
|
||||
const projPath2 = await testUtils.createTestSqlProjFile(baselines.newProjectFileBaseline);
|
||||
it.skip('Should not allow adding circular project references', async function (): Promise<void> {
|
||||
const projPath1 = await testUtils.createTestSqlProjFile(this.test, baselines.openProjectFileBaseline);
|
||||
const projPath2 = await testUtils.createTestSqlProjFile(this.test, baselines.newProjectFileBaseline);
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
|
||||
const project1 = await Project.openProject(vscode.Uri.file(projPath1).fsPath);
|
||||
@@ -707,8 +707,8 @@ describe('ProjectsController', function (): void {
|
||||
should(showErrorMessageSpy.called).be.true('showErrorMessage should have been called');
|
||||
});
|
||||
|
||||
it('Should add dacpac references as relative paths', async function (): Promise<void> {
|
||||
const projFilePath = await testUtils.createTestSqlProjFile(baselines.newProjectFileBaseline);
|
||||
it.skip('Should add dacpac references as relative paths', async function (): Promise<void> {
|
||||
const projFilePath = await testUtils.createTestSqlProjFile(this.test, baselines.newProjectFileBaseline);
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
|
||||
const project1 = await Project.openProject(vscode.Uri.file(projFilePath).fsPath);
|
||||
@@ -731,7 +731,7 @@ describe('ProjectsController', function (): void {
|
||||
{ treeDataProvider: new SqlDatabaseProjectTreeViewProvider(), element: undefined });
|
||||
should(showErrorMessageSpy.notCalled).be.true('showErrorMessage should not have been called');
|
||||
should(project1.databaseReferences.length).equal(1, 'Dacpac reference should have been added');
|
||||
should(project1.databaseReferences[0].databaseName).equal('sameFolderTest');
|
||||
should(project1.databaseReferences[0].referenceName).equal('sameFolderTest');
|
||||
should(project1.databaseReferences[0].pathForSqlProj()).equal('sameFolderTest.dacpac');
|
||||
// make sure reference to sameFolderTest.dacpac was added to project file
|
||||
let projFileText = (await fs.readFile(projFilePath)).toString();
|
||||
@@ -746,7 +746,7 @@ describe('ProjectsController', function (): void {
|
||||
{ treeDataProvider: new SqlDatabaseProjectTreeViewProvider(), element: undefined });
|
||||
should(showErrorMessageSpy.notCalled).be.true('showErrorMessage should not have been called');
|
||||
should(project1.databaseReferences.length).equal(2, 'Another dacpac reference should have been added');
|
||||
should(project1.databaseReferences[1].databaseName).equal('nestedFolderTest');
|
||||
should(project1.databaseReferences[1].referenceName).equal('nestedFolderTest');
|
||||
should(project1.databaseReferences[1].pathForSqlProj()).equal('refs\\nestedFolderTest.dacpac');
|
||||
// make sure reference to nestedFolderTest.dacpac was added to project file
|
||||
projFileText = (await fs.readFile(projFilePath)).toString();
|
||||
@@ -761,7 +761,7 @@ describe('ProjectsController', function (): void {
|
||||
{ treeDataProvider: new SqlDatabaseProjectTreeViewProvider(), element: undefined });
|
||||
should(showErrorMessageSpy.notCalled).be.true('showErrorMessage should not have been called');
|
||||
should(project1.databaseReferences.length).equal(3, 'Another dacpac reference should have been added');
|
||||
should(project1.databaseReferences[2].databaseName).equal('outsideFolderTest');
|
||||
should(project1.databaseReferences[2].referenceName).equal('outsideFolderTest');
|
||||
should(project1.databaseReferences[2].pathForSqlProj()).equal('..\\someFolder\\outsideFolderTest.dacpac');
|
||||
// make sure reference to outsideFolderTest.dacpac was added to project file
|
||||
projFileText = (await fs.readFile(projFilePath)).toString();
|
||||
@@ -770,9 +770,10 @@ describe('ProjectsController', function (): void {
|
||||
});
|
||||
|
||||
describe('AutoRest generation', function (): void {
|
||||
it('Should create project from autorest-generated files', async function (): Promise<void> {
|
||||
const parentFolder = await testUtils.generateTestFolderPath();
|
||||
await testUtils.createDummyFileStructure();
|
||||
// skipping for now because this feature is hidden under preview flag
|
||||
it.skip('Should create project from autorest-generated files', async function (): Promise<void> {
|
||||
const parentFolder = await testUtils.generateTestFolderPath(this.test);
|
||||
await testUtils.createDummyFileStructure(this.test);
|
||||
const specName = 'DummySpec.yaml';
|
||||
const renamedProjectName = 'RenamedProject';
|
||||
const newProjFolder = path.join(parentFolder, renamedProjectName);
|
||||
@@ -793,8 +794,8 @@ describe('ProjectsController', function (): void {
|
||||
});
|
||||
|
||||
projController.setup(x => x.generateAutorestFiles(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(async () => {
|
||||
await testUtils.createDummyFileStructure(true, fileList, newProjFolder);
|
||||
await testUtils.createTestFile('SELECT \'This is a post-deployment script\'', constants.autorestPostDeploymentScriptName, newProjFolder);
|
||||
await testUtils.createDummyFileStructure(this.test, true, fileList, newProjFolder);
|
||||
await testUtils.createTestFile(this.test, 'SELECT \'This is a post-deployment script\'', constants.autorestPostDeploymentScriptName, newProjFolder);
|
||||
return 'some dummy console output';
|
||||
});
|
||||
|
||||
@@ -823,7 +824,7 @@ describe('ProjectsController', function (): void {
|
||||
const spy = sinon.spy(vscode.window, 'showErrorMessage');
|
||||
sinon.stub(vscode.window, 'showWarningMessage').returns(<any>Promise.resolve(constants.move));
|
||||
|
||||
let proj = await testUtils.createTestProject(baselines.openSdkStyleSqlProjectBaseline);
|
||||
let proj = await testUtils.createTestProject(this.test, baselines.openSdkStyleSqlProjectBaseline);
|
||||
|
||||
const projTreeRoot = await setupMoveTest(proj);
|
||||
|
||||
@@ -846,7 +847,7 @@ describe('ProjectsController', function (): void {
|
||||
const spy = sinon.spy(vscode.window, 'showErrorMessage');
|
||||
sinon.stub(vscode.window, 'showWarningMessage').returns(<any>Promise.resolve(constants.move));
|
||||
|
||||
let proj = await testUtils.createTestProject(baselines.openSdkStyleSqlProjectBaseline);
|
||||
let proj = await testUtils.createTestProject(this.test, baselines.openSdkStyleSqlProjectBaseline);
|
||||
const projTreeRoot = await setupMoveTest(proj);
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
|
||||
@@ -868,7 +869,7 @@ describe('ProjectsController', function (): void {
|
||||
|
||||
it('Should only allow moving files', async function (): Promise<void> {
|
||||
const spy = sinon.spy(vscode.window, 'showErrorMessage');
|
||||
let proj = await testUtils.createTestProject(baselines.openSdkStyleSqlProjectBaseline);
|
||||
let proj = await testUtils.createTestProject(this.test, baselines.openSdkStyleSqlProjectBaseline);
|
||||
const projTreeRoot = await setupMoveTest(proj);
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
|
||||
@@ -902,8 +903,8 @@ describe('ProjectsController', function (): void {
|
||||
const spy = sinon.spy(vscode.window, 'showErrorMessage');
|
||||
sinon.stub(vscode.window, 'showWarningMessage').returns(<any>Promise.resolve(constants.move));
|
||||
|
||||
let proj1 = await testUtils.createTestProject(baselines.openSdkStyleSqlProjectBaseline);
|
||||
let proj2 = await testUtils.createTestProject(baselines.openSdkStyleSqlProjectBaseline);
|
||||
let proj1 = await testUtils.createTestProject(this.test, baselines.openSdkStyleSqlProjectBaseline);
|
||||
let proj2 = await testUtils.createTestProject(this.test, baselines.openSdkStyleSqlProjectBaseline);
|
||||
|
||||
const projTreeRoot1 = await setupMoveTest(proj1);
|
||||
const projTreeRoot2 = await setupMoveTest(proj2);
|
||||
@@ -926,7 +927,7 @@ describe('ProjectsController', function (): void {
|
||||
describe('Rename file', function (): void {
|
||||
it('Should not do anything if no new name is provided', async function (): Promise<void> {
|
||||
sinon.stub(vscode.window, 'showInputBox').resolves('');
|
||||
let proj = await testUtils.createTestProject(baselines.openSdkStyleSqlProjectBaseline);
|
||||
let proj = await testUtils.createTestProject(this.test, baselines.openSdkStyleSqlProjectBaseline);
|
||||
const projTreeRoot = await setupMoveTest(proj);
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
|
||||
@@ -942,7 +943,7 @@ describe('ProjectsController', function (): void {
|
||||
|
||||
it('Should rename a sql object file', async function (): Promise<void> {
|
||||
sinon.stub(vscode.window, 'showInputBox').resolves('newName');
|
||||
let proj = await testUtils.createTestProject(baselines.openSdkStyleSqlProjectBaseline);
|
||||
let proj = await testUtils.createTestProject(this.test, baselines.openSdkStyleSqlProjectBaseline);
|
||||
const projTreeRoot = await setupMoveTest(proj);
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
|
||||
@@ -957,7 +958,7 @@ describe('ProjectsController', function (): void {
|
||||
});
|
||||
|
||||
it('Should rename a pre and post deploy script', async function (): Promise<void> {
|
||||
let proj = await testUtils.createTestProject(baselines.newSdkStyleProjectSdkNodeBaseline);
|
||||
let proj = await testUtils.createTestProject(this.test, baselines.newSdkStyleProjectSdkNodeBaseline);
|
||||
await proj.addScriptItem('Script.PreDeployment1.sql', 'pre-deployment stuff', ItemType.preDeployScript);
|
||||
await proj.addScriptItem('Script.PostDeployment1.sql', 'post-deployment stuff', ItemType.postDeployScript);
|
||||
|
||||
@@ -989,7 +990,7 @@ describe('ProjectsController', function (): void {
|
||||
|
||||
describe('SqlCmd Variables', function (): void {
|
||||
it('Should delete sqlcmd variable', async function (): Promise<void> {
|
||||
let project = await testUtils.createTestProject(baselines.openSdkStyleSqlProjectBaseline);
|
||||
let project = await testUtils.createTestProject(this.test, baselines.openSdkStyleSqlProjectBaseline);
|
||||
const sqlProjectsService = await utils.getSqlProjectsService();
|
||||
await sqlProjectsService.openProject(project.projectFilePath);
|
||||
|
||||
@@ -1013,12 +1014,72 @@ describe('ProjectsController', function (): void {
|
||||
project = await Project.openProject(project.projectFilePath);
|
||||
should(Object.keys(project.sqlCmdVariables).length).equal(1, 'The project should only have 1 sqlcmd variable after deletion');
|
||||
});
|
||||
|
||||
it('Should add sqlcmd variable', async function (): Promise<void> {
|
||||
let project = await testUtils.createTestProject(this.test, baselines.openSdkStyleSqlProjectBaseline);
|
||||
const sqlProjectsService = await utils.getSqlProjectsService();
|
||||
await sqlProjectsService.openProject(project.projectFilePath);
|
||||
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
const projRoot = new ProjectRootTreeItem(project);
|
||||
|
||||
should(Object.keys(project.sqlCmdVariables).length).equal(2, 'The project should start with 2 sqlcmd variables');
|
||||
|
||||
const inputBoxStub = sinon.stub(vscode.window, 'showInputBox');
|
||||
inputBoxStub.resolves('');
|
||||
await projController.addSqlCmdVariable(createWorkspaceTreeItem(projRoot.children.find(x => x.friendlyName === constants.sqlcmdVariablesNodeName)!));
|
||||
|
||||
// reload project
|
||||
project = await Project.openProject(project.projectFilePath);
|
||||
should(Object.keys(project.sqlCmdVariables).length).equal(2, 'The project should still have 2 sqlcmd variables if no name was provided');
|
||||
|
||||
inputBoxStub.reset();
|
||||
inputBoxStub.onFirstCall().resolves('newVariable');
|
||||
inputBoxStub.onSecondCall().resolves('testValue');
|
||||
await projController.addSqlCmdVariable(createWorkspaceTreeItem(projRoot.children.find(x => x.friendlyName === constants.sqlcmdVariablesNodeName)!));
|
||||
|
||||
// reload project
|
||||
project = await Project.openProject(project.projectFilePath);
|
||||
should(Object.keys(project.sqlCmdVariables).length).equal(3, 'The project should have 3 sqlcmd variable after adding a new one');
|
||||
});
|
||||
|
||||
it('Should update sqlcmd variable', async function (): Promise<void> {
|
||||
let project = await testUtils.createTestProject(this.test, baselines.openSdkStyleSqlProjectBaseline);
|
||||
const sqlProjectsService = await utils.getSqlProjectsService();
|
||||
await sqlProjectsService.openProject(project.projectFilePath);
|
||||
|
||||
const projController = new ProjectsController(testContext.outputChannel);
|
||||
const projRoot = new ProjectRootTreeItem(project);
|
||||
|
||||
should(Object.keys(project.sqlCmdVariables).length).equal(2, 'The project should start with 2 sqlcmd variables');
|
||||
|
||||
const inputBoxStub = sinon.stub(vscode.window, 'showInputBox');
|
||||
inputBoxStub.resolves('');
|
||||
const sqlcmdVarToUpdate = projRoot.children.find(x => x.friendlyName === constants.sqlcmdVariablesNodeName)!.children[0];
|
||||
const originalValue = project.sqlCmdVariables[sqlcmdVarToUpdate.friendlyName];
|
||||
await projController.editSqlCmdVariable(createWorkspaceTreeItem(sqlcmdVarToUpdate));
|
||||
|
||||
// reload project
|
||||
project = await Project.openProject(project.projectFilePath);
|
||||
should(Object.keys(project.sqlCmdVariables).length).equal(2, 'The project should still have 2 sqlcmd variables');
|
||||
should(project.sqlCmdVariables[sqlcmdVarToUpdate.friendlyName]).equal(originalValue, 'The value of the sqlcmd variable should not have changed');
|
||||
|
||||
inputBoxStub.reset();
|
||||
const updatedValue = 'newValue';
|
||||
inputBoxStub.resolves(updatedValue);
|
||||
await projController.editSqlCmdVariable(createWorkspaceTreeItem(sqlcmdVarToUpdate));
|
||||
|
||||
// reload project
|
||||
project = await Project.openProject(project.projectFilePath);
|
||||
should(Object.keys(project.sqlCmdVariables).length).equal(2, 'The project should still have 2 sqlcmd variables');
|
||||
should(project.sqlCmdVariables[sqlcmdVarToUpdate.friendlyName]).equal(updatedValue, 'The value of the sqlcmd variable should have been updated');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
async function setupDeleteExcludeTest(proj: Project): Promise<[FileProjectEntry, ProjectRootTreeItem, FileProjectEntry, FileProjectEntry, FileProjectEntry]> {
|
||||
await proj.addFolderItem('UpperFolder');
|
||||
await proj.addFolderItem('UpperFolder/LowerFolder');
|
||||
await proj.addFolder('UpperFolder');
|
||||
await proj.addFolder('UpperFolder/LowerFolder');
|
||||
const scriptEntry = await proj.addScriptItem('UpperFolder/LowerFolder/someScript.sql', 'not a real script');
|
||||
await proj.addScriptItem('UpperFolder/LowerFolder/someOtherScript.sql', 'Also not a real script');
|
||||
await proj.addScriptItem('../anotherScript.sql', 'Also not a real script');
|
||||
@@ -1030,7 +1091,8 @@ async function setupDeleteExcludeTest(proj: Project): Promise<[FileProjectEntry,
|
||||
sinon.stub(vscode.window, 'showWarningMessage').returns(<any>Promise.resolve(constants.yesString));
|
||||
|
||||
// confirm setup
|
||||
should(proj.files.length).equal(5, 'number of file/folder entries');
|
||||
should(proj.files.length).equal(3, 'number of file entries');
|
||||
should(proj.folders.length).equal(2, 'number of folder entries');
|
||||
should(proj.preDeployScripts.length).equal(1, 'number of pre-deployment script entries');
|
||||
should(proj.postDeployScripts.length).equal(1, 'number of post-deployment script entries');
|
||||
should(proj.noneDeployScripts.length).equal(1, 'number of none script entries');
|
||||
@@ -1041,8 +1103,8 @@ async function setupDeleteExcludeTest(proj: Project): Promise<[FileProjectEntry,
|
||||
}
|
||||
|
||||
async function setupMoveTest(proj: Project): Promise<ProjectRootTreeItem> {
|
||||
await proj.addFolderItem('UpperFolder');
|
||||
await proj.addFolderItem('UpperFolder/LowerFolder');
|
||||
await proj.addFolder('UpperFolder');
|
||||
await proj.addFolder('UpperFolder/LowerFolder');
|
||||
await proj.addScriptItem('UpperFolder/LowerFolder/someScript.sql', 'not a real script');
|
||||
await proj.addScriptItem('UpperFolder/LowerFolder/someOtherScript.sql', 'Also not a real script');
|
||||
await proj.addScriptItem('../anotherScript.sql', 'Also not a real script');
|
||||
|
||||
@@ -21,27 +21,27 @@ describe('Project Tree tests', function (): void {
|
||||
const sqlprojUri = vscode.Uri.file(`${root}Fake.sqlproj`);
|
||||
|
||||
let inputNodes: (FileNode | FolderNode)[] = [
|
||||
new SqlObjectFileNode(vscode.Uri.file(`${root}C`), sqlprojUri),
|
||||
new SqlObjectFileNode(vscode.Uri.file(`${root}D`), sqlprojUri),
|
||||
new FolderNode(vscode.Uri.file(`${root}Z`), sqlprojUri),
|
||||
new FolderNode(vscode.Uri.file(`${root}X`), sqlprojUri),
|
||||
new SqlObjectFileNode(vscode.Uri.file(`${root}B`), sqlprojUri),
|
||||
new SqlObjectFileNode(vscode.Uri.file(`${root}A`), sqlprojUri),
|
||||
new FolderNode(vscode.Uri.file(`${root}W`), sqlprojUri),
|
||||
new FolderNode(vscode.Uri.file(`${root}Y`), sqlprojUri)
|
||||
new SqlObjectFileNode(vscode.Uri.file(`${root}C`), sqlprojUri, 'C'),
|
||||
new SqlObjectFileNode(vscode.Uri.file(`${root}D`), sqlprojUri, 'D'),
|
||||
new FolderNode(vscode.Uri.file(`${root}Z`), sqlprojUri, 'Z'),
|
||||
new FolderNode(vscode.Uri.file(`${root}X`), sqlprojUri, 'X'),
|
||||
new SqlObjectFileNode(vscode.Uri.file(`${root}B`), sqlprojUri, 'B'),
|
||||
new SqlObjectFileNode(vscode.Uri.file(`${root}A`), sqlprojUri, 'A'),
|
||||
new FolderNode(vscode.Uri.file(`${root}W`), sqlprojUri, 'W'),
|
||||
new FolderNode(vscode.Uri.file(`${root}Y`), sqlprojUri, 'Y')
|
||||
];
|
||||
|
||||
inputNodes = inputNodes.sort(sortFileFolderNodes);
|
||||
|
||||
const expectedNodes: (FileNode | FolderNode)[] = [
|
||||
new FolderNode(vscode.Uri.file(`${root}W`), sqlprojUri),
|
||||
new FolderNode(vscode.Uri.file(`${root}X`), sqlprojUri),
|
||||
new FolderNode(vscode.Uri.file(`${root}Y`), sqlprojUri),
|
||||
new FolderNode(vscode.Uri.file(`${root}Z`), sqlprojUri),
|
||||
new SqlObjectFileNode(vscode.Uri.file(`${root}A`), sqlprojUri),
|
||||
new SqlObjectFileNode(vscode.Uri.file(`${root}B`), sqlprojUri),
|
||||
new SqlObjectFileNode(vscode.Uri.file(`${root}C`), sqlprojUri),
|
||||
new SqlObjectFileNode(vscode.Uri.file(`${root}D`), sqlprojUri)
|
||||
new FolderNode(vscode.Uri.file(`${root}W`), sqlprojUri, 'W'),
|
||||
new FolderNode(vscode.Uri.file(`${root}X`), sqlprojUri, 'X'),
|
||||
new FolderNode(vscode.Uri.file(`${root}Y`), sqlprojUri, 'Y'),
|
||||
new FolderNode(vscode.Uri.file(`${root}Z`), sqlprojUri, 'Z'),
|
||||
new SqlObjectFileNode(vscode.Uri.file(`${root}A`), sqlprojUri, 'A'),
|
||||
new SqlObjectFileNode(vscode.Uri.file(`${root}B`), sqlprojUri, 'B'),
|
||||
new SqlObjectFileNode(vscode.Uri.file(`${root}C`), sqlprojUri, 'C'),
|
||||
new SqlObjectFileNode(vscode.Uri.file(`${root}D`), sqlprojUri, 'D')
|
||||
];
|
||||
|
||||
should(inputNodes.map(n => n.relativeProjectUri.path)).deepEqual(expectedNodes.map(n => n.relativeProjectUri.path));
|
||||
@@ -54,18 +54,18 @@ describe('Project Tree tests', function (): void {
|
||||
// nested entries before explicit top-level folder entry
|
||||
// also, ordering of files/folders at all levels
|
||||
proj.files.push(proj.createFileProjectEntry(path.join('someFolder', 'bNestedTest.sql'), EntryType.File));
|
||||
proj.files.push(proj.createFileProjectEntry(path.join('someFolder', 'bNestedFolder'), EntryType.Folder));
|
||||
proj.folders.push(proj.createFileProjectEntry(path.join('someFolder', 'bNestedFolder'), EntryType.Folder));
|
||||
proj.files.push(proj.createFileProjectEntry(path.join('someFolder', 'aNestedTest.sql'), EntryType.File));
|
||||
proj.files.push(proj.createFileProjectEntry(path.join('someFolder', 'aNestedFolder'), EntryType.Folder));
|
||||
proj.files.push(proj.createFileProjectEntry('someFolder', EntryType.Folder));
|
||||
proj.folders.push(proj.createFileProjectEntry(path.join('someFolder', 'aNestedFolder'), EntryType.Folder));
|
||||
proj.folders.push(proj.createFileProjectEntry('someFolder', EntryType.Folder));
|
||||
|
||||
// duplicate files
|
||||
proj.files.push(proj.createFileProjectEntry('duplicate.sql', EntryType.File));
|
||||
proj.files.push(proj.createFileProjectEntry('duplicate.sql', EntryType.File));
|
||||
|
||||
// duplicate folders
|
||||
proj.files.push(proj.createFileProjectEntry('duplicateFolder', EntryType.Folder));
|
||||
proj.files.push(proj.createFileProjectEntry('duplicateFolder', EntryType.Folder));
|
||||
proj.folders.push(proj.createFileProjectEntry('duplicateFolder', EntryType.Folder));
|
||||
proj.folders.push(proj.createFileProjectEntry('duplicateFolder', EntryType.Folder));
|
||||
|
||||
const tree = new ProjectRootTreeItem(proj);
|
||||
should(tree.children.map(x => x.relativeProjectUri.path)).deepEqual([
|
||||
@@ -102,7 +102,9 @@ describe('Project Tree tests', function (): void {
|
||||
// nested entries before explicit top-level folder entry
|
||||
// also, ordering of files/folders at all levels
|
||||
proj.files.push(proj.createFileProjectEntry('someFolder1\\MyNestedFolder1\\MyFile1.sql', EntryType.File));
|
||||
proj.files.push(proj.createFileProjectEntry('someFolder1\\MyNestedFolder2', EntryType.Folder));
|
||||
proj.folders.push(proj.createFileProjectEntry('someFolder1\\MyNestedFolder2', EntryType.Folder));
|
||||
proj.folders.push(proj.createFileProjectEntry('someFolder1', EntryType.Folder));
|
||||
proj.folders.push(proj.createFileProjectEntry('someFolder1\\MyNestedFolder1', EntryType.Folder));
|
||||
proj.files.push(proj.createFileProjectEntry('someFolder1\\MyFile2.sql', EntryType.File));
|
||||
|
||||
const tree = new ProjectRootTreeItem(proj);
|
||||
|
||||
@@ -29,13 +29,13 @@ describe('Publish profile tests', function (): void {
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
after(async function(): Promise<void> {
|
||||
after(async function (): Promise<void> {
|
||||
await testUtils.deleteGeneratedTestFolder();
|
||||
});
|
||||
|
||||
it('Should read database name, integrated security connection string, and SQLCMD variables from publish profile', async function (): Promise<void> {
|
||||
await baselines.loadBaselines();
|
||||
const profilePath = await testUtils.createTestFile(baselines.publishProfileIntegratedSecurityBaseline, 'publishProfile.publish.xml');
|
||||
const profilePath = await testUtils.createTestFile(this.test, baselines.publishProfileIntegratedSecurityBaseline, 'publishProfile.publish.xml');
|
||||
const connectionResult = {
|
||||
connected: true,
|
||||
connectionId: 'connId',
|
||||
@@ -58,7 +58,7 @@ describe('Publish profile tests', function (): void {
|
||||
|
||||
it('Should read database name, SQL login connection string, and SQLCMD variables from publish profile', async function (): Promise<void> {
|
||||
await baselines.loadBaselines();
|
||||
const profilePath = await testUtils.createTestFile(baselines.publishProfileSqlLoginBaseline, 'publishProfile.publish.xml');
|
||||
const profilePath = await testUtils.createTestFile(this.test, baselines.publishProfileSqlLoginBaseline, 'publishProfile.publish.xml');
|
||||
const connectionResult = {
|
||||
providerName: 'MSSQL',
|
||||
connectionId: 'connId',
|
||||
@@ -83,7 +83,7 @@ describe('Publish profile tests', function (): void {
|
||||
|
||||
it('Should read SQLCMD variables correctly from publish profile even if DefaultValue is used', async function (): Promise<void> {
|
||||
await baselines.loadBaselines();
|
||||
const profilePath = await testUtils.createTestFile(baselines.publishProfileDefaultValueBaseline, 'publishProfile.publish.xml');
|
||||
const profilePath = await testUtils.createTestFile(this.test, baselines.publishProfileDefaultValueBaseline, 'publishProfile.publish.xml');
|
||||
testContext.dacFxService.setup(x => x.getOptionsFromProfile(TypeMoq.It.isAny())).returns(async () => {
|
||||
return Promise.resolve(mockDacFxOptionsResult);
|
||||
});
|
||||
@@ -97,7 +97,7 @@ describe('Publish profile tests', function (): void {
|
||||
|
||||
it('Should throw error when connecting does not work', async function (): Promise<void> {
|
||||
await baselines.loadBaselines();
|
||||
const profilePath = await testUtils.createTestFile(baselines.publishProfileIntegratedSecurityBaseline, 'publishProfile.publish.xml');
|
||||
const profilePath = await testUtils.createTestFile(this.test, baselines.publishProfileIntegratedSecurityBaseline, 'publishProfile.publish.xml');
|
||||
|
||||
sinon.stub(azdata.connection, 'connect').throws(new Error('Could not connect'));
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@ import should = require('should');
|
||||
import { AssertionError } from 'assert';
|
||||
import { Project } from '../models/project';
|
||||
import { Uri } from 'vscode';
|
||||
import { exists } from '../common/utils';
|
||||
import { exists, getSqlProjectsService } from '../common/utils';
|
||||
import { ProjectType } from 'mssql';
|
||||
|
||||
export async function shouldThrowSpecificError(block: Function, expectedMessage: string, details?: string) {
|
||||
let succeeded = false;
|
||||
@@ -30,37 +31,52 @@ export async function shouldThrowSpecificError(block: Function, expectedMessage:
|
||||
}
|
||||
}
|
||||
|
||||
export async function createTestSqlProjFile(contents: string, folderPath?: string): Promise<string> {
|
||||
folderPath = folderPath ?? path.join(await generateTestFolderPath(), 'TestProject');
|
||||
export async function createTestSqlProject(test: Mocha.Runnable | undefined): Promise<Project> {
|
||||
const projPath = await getTestProjectPath(test);
|
||||
await (await getSqlProjectsService()).createProject(projPath, ProjectType.SdkStyle);
|
||||
return await Project.openProject(projPath);
|
||||
}
|
||||
|
||||
export async function getTestProjectPath(test: Mocha.Runnable | undefined): Promise<string> {
|
||||
return path.join(await generateTestFolderPath(test), 'TestProject', 'TestProject.sqlproj');
|
||||
}
|
||||
|
||||
export async function createTestSqlProjFile(test: Mocha.Runnable | undefined, contents: string, folderPath?: string): Promise<string> {
|
||||
folderPath = folderPath ?? path.join(await generateTestFolderPath(test), 'TestProject');
|
||||
const macroDict: Record<string, string> = {
|
||||
'PROJECT_DSP': constants.defaultDSP
|
||||
};
|
||||
contents = templates.macroExpansion(contents, macroDict);
|
||||
return await createTestFile(contents, 'TestProject.sqlproj', folderPath);
|
||||
return await createTestFile(test, contents, 'TestProject.sqlproj', folderPath);
|
||||
}
|
||||
|
||||
export async function createTestProject(contents: string, folderPath?: string): Promise<Project> {
|
||||
return await Project.openProject(await createTestSqlProjFile(contents, folderPath));
|
||||
export async function createTestProject(test: Mocha.Runnable | undefined, contents: string, folderPath?: string): Promise<Project> {
|
||||
return await Project.openProject(await createTestSqlProjFile(test, contents, folderPath));
|
||||
}
|
||||
|
||||
export async function createTestDataSources(contents: string, folderPath?: string): Promise<string> {
|
||||
return await createTestFile(contents, constants.dataSourcesFileName, folderPath);
|
||||
export async function createTestDataSources(test: Mocha.Runnable | undefined, contents: string, folderPath?: string): Promise<string> {
|
||||
return await createTestFile(test, contents, constants.dataSourcesFileName, folderPath);
|
||||
}
|
||||
|
||||
export async function generateTestFolderPath(): Promise<string> {
|
||||
const folderPath = path.join(generateBaseFolderName(), `TestRun_${new Date().getTime()}`);
|
||||
export async function generateTestFolderPath(test: Mocha.Runnable | undefined): Promise<string> {
|
||||
const testName = test?.title === undefined ? '' : `${normalizeTestName(test?.title)}_`
|
||||
const folderPath = path.join(generateBaseFolderName(), `Test_${testName}${new Date().getTime()}_${Math.floor((Math.random() * 1000))}`);
|
||||
await fs.mkdir(folderPath, { recursive: true });
|
||||
|
||||
return folderPath;
|
||||
}
|
||||
|
||||
function normalizeTestName(rawTestName: string): string {
|
||||
return rawTestName.replace(/[^\w]+/g, '').substring(0, 40); // remove all non-alphanumeric characters, then trim to a reasonable length
|
||||
}
|
||||
|
||||
export function generateBaseFolderName(): string {
|
||||
const folderPath = path.join(os.tmpdir(), 'ADS_Tests');
|
||||
return folderPath;
|
||||
}
|
||||
|
||||
export async function createTestFile(contents: string, fileName: string, folderPath?: string): Promise<string> {
|
||||
folderPath = folderPath ?? await generateTestFolderPath();
|
||||
export async function createTestFile(test: Mocha.Runnable | undefined, contents: string, fileName: string, folderPath?: string): Promise<string> {
|
||||
folderPath = folderPath ?? await generateTestFolderPath(test);
|
||||
const filePath = path.join(folderPath, fileName);
|
||||
|
||||
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
||||
@@ -89,13 +105,12 @@ export async function createTestFile(contents: string, fileName: string, folderP
|
||||
* @param createList Boolean specifying to create a list of the files and folders been created
|
||||
* @param list List of files and folders that are been created
|
||||
*/
|
||||
export async function createDummyFileStructure(createList?: boolean, list?: Uri[], testFolderPath?: string): Promise<string> {
|
||||
testFolderPath = testFolderPath ?? await generateTestFolderPath();
|
||||
export async function createDummyFileStructure(test: Mocha.Runnable | undefined, createList?: boolean, list?: Uri[], testFolderPath?: string): Promise<string> {
|
||||
testFolderPath = testFolderPath ?? await generateTestFolderPath(test);
|
||||
|
||||
let filePath = path.join(testFolderPath, 'file1.sql');
|
||||
await fs.writeFile(filePath, '');
|
||||
if (createList) {
|
||||
list?.push(Uri.file(testFolderPath));
|
||||
list?.push(Uri.file(filePath));
|
||||
}
|
||||
|
||||
@@ -103,10 +118,6 @@ export async function createDummyFileStructure(createList?: boolean, list?: Uri[
|
||||
let dirName = path.join(testFolderPath, `folder${dirCount}`);
|
||||
await fs.mkdir(dirName, { recursive: true });
|
||||
|
||||
if (createList) {
|
||||
list?.push(Uri.file(dirName));
|
||||
}
|
||||
|
||||
for (let fileCount = 1; fileCount <= 5; fileCount++) {
|
||||
let fileName = path.join(dirName, `file${fileCount}.sql`);
|
||||
await fs.writeFile(fileName, '');
|
||||
@@ -117,7 +128,7 @@ export async function createDummyFileStructure(createList?: boolean, list?: Uri[
|
||||
}
|
||||
|
||||
filePath = path.join(testFolderPath, 'file2.txt');
|
||||
//await touchFile(filePath);
|
||||
|
||||
await fs.writeFile(filePath, '');
|
||||
if (createList) {
|
||||
list?.push(Uri.file(filePath));
|
||||
@@ -153,8 +164,8 @@ export async function createDummyFileStructure(createList?: boolean, list?: Uri[
|
||||
* @param createList Boolean specifying to create a list of the files and folders been created
|
||||
* @param list List of files and folders that are been created
|
||||
*/
|
||||
export async function createDummyFileStructureWithPrePostDeployScripts(createList?: boolean, list?: Uri[], testFolderPath?: string): Promise<string> {
|
||||
testFolderPath = await createDummyFileStructure(createList, list, testFolderPath);
|
||||
export async function createDummyFileStructureWithPrePostDeployScripts(test: Mocha.Runnable | undefined, createList?: boolean, list?: Uri[], testFolderPath?: string): Promise<string> {
|
||||
testFolderPath = await createDummyFileStructure(test, createList, list, testFolderPath);
|
||||
|
||||
// add pre-deploy scripts
|
||||
const predeployscript1 = path.join(testFolderPath, 'Script.PreDeployment1.sql');
|
||||
@@ -189,10 +200,10 @@ export async function createDummyFileStructureWithPrePostDeployScripts(createLis
|
||||
return testFolderPath;
|
||||
}
|
||||
|
||||
export async function createListOfFiles(filePath?: string): Promise<Uri[]> {
|
||||
export async function createListOfFiles(test: Mocha.Runnable | undefined, filePath?: string): Promise<Uri[]> {
|
||||
let fileFolderList: Uri[] = [];
|
||||
|
||||
await createDummyFileStructure(true, fileFolderList, filePath);
|
||||
await createDummyFileStructure(test, true, fileFolderList, filePath);
|
||||
|
||||
return fileFolderList;
|
||||
}
|
||||
@@ -201,14 +212,14 @@ export async function createListOfFiles(filePath?: string): Promise<Uri[]> {
|
||||
* TestFolder directory structure
|
||||
* - file1.sql
|
||||
* - folder1
|
||||
* -file1.sql
|
||||
* -file2.sql
|
||||
* -test1.sql
|
||||
* -test2.sql
|
||||
* -testLongerName.sql
|
||||
* - file1.sql
|
||||
* - file2.sql
|
||||
* - test1.sql
|
||||
* - test2.sql
|
||||
* - testLongerName.sql
|
||||
* - folder2
|
||||
* -file1.sql
|
||||
* -file2.sql
|
||||
* - file1.sql
|
||||
* - file2.sql
|
||||
* - Script.PreDeployment1.sql
|
||||
* - Script.PostDeployment1.sql
|
||||
* - Script.PostDeployment2.sql
|
||||
@@ -262,7 +273,6 @@ export async function createOtherDummyFiles(testFolderPath: string): Promise<Uri
|
||||
export async function deleteGeneratedTestFolder(): Promise<void> {
|
||||
const testFolderPath: string = generateBaseFolderName();
|
||||
if (await exists(testFolderPath)) {
|
||||
// cleanup folder
|
||||
await fs.rm(testFolderPath, { recursive: true });
|
||||
await fs.rm(testFolderPath, { recursive: true }); // cleanup folder
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,20 +6,22 @@
|
||||
import * as should from 'should';
|
||||
import * as path from 'path';
|
||||
import * as os from 'os';
|
||||
import * as constants from '../common/constants';
|
||||
import * as utils from '../common/utils';
|
||||
|
||||
import { createDummyFileStructure, deleteGeneratedTestFolder } from './testUtils';
|
||||
import { exists, trimUri, removeSqlCmdVariableFormatting, formatSqlCmdVariable, isValidSqlCmdVariableName, timeConversion, validateSqlServerPortNumber, isEmptyString, detectCommandInstallation, isValidSQLPassword, findSqlVersionInImageName, findSqlVersionInTargetPlatform } from '../common/utils';
|
||||
import { Uri } from 'vscode';
|
||||
|
||||
describe('Tests to verify utils functions', function (): void {
|
||||
it('Should determine existence of files/folders', async () => {
|
||||
let testFolderPath = await createDummyFileStructure();
|
||||
let testFolderPath = await createDummyFileStructure(undefined);
|
||||
|
||||
should(await exists(testFolderPath)).equal(true);
|
||||
should(await exists(path.join(testFolderPath, 'file1.sql'))).equal(true);
|
||||
should(await exists(path.join(testFolderPath, 'folder2'))).equal(true);
|
||||
should(await exists(path.join(testFolderPath, 'folder4'))).equal(false);
|
||||
should(await exists(path.join(testFolderPath, 'folder2', 'file4.sql'))).equal(true);
|
||||
should(await exists(path.join(testFolderPath, 'folder4', 'file2.sql'))).equal(false);
|
||||
should(await utils.exists(testFolderPath)).equal(true);
|
||||
should(await utils.exists(path.join(testFolderPath, 'file1.sql'))).equal(true);
|
||||
should(await utils.exists(path.join(testFolderPath, 'folder2'))).equal(true);
|
||||
should(await utils.exists(path.join(testFolderPath, 'folder4'))).equal(false);
|
||||
should(await utils.exists(path.join(testFolderPath, 'folder2', 'file4.sql'))).equal(true);
|
||||
should(await utils.exists(path.join(testFolderPath, 'folder4', 'file2.sql'))).equal(false);
|
||||
|
||||
await deleteGeneratedTestFolder();
|
||||
});
|
||||
@@ -28,117 +30,124 @@ describe('Tests to verify utils functions', function (): void {
|
||||
const root = os.platform() === 'win32' ? 'Z:\\' : '/';
|
||||
let projectUri = Uri.file(path.join(root, 'project', 'folder', 'project.sqlproj'));
|
||||
let fileUri = Uri.file(path.join(root, 'project', 'folder', 'file.sql'));
|
||||
should(trimUri(projectUri, fileUri)).equal('file.sql');
|
||||
should(utils.trimUri(projectUri, fileUri)).equal('file.sql');
|
||||
|
||||
fileUri = Uri.file(path.join(root, 'project', 'file.sql'));
|
||||
let urifile = trimUri(projectUri, fileUri);
|
||||
let urifile = utils.trimUri(projectUri, fileUri);
|
||||
should(urifile).equal('../file.sql');
|
||||
|
||||
fileUri = Uri.file(path.join(root, 'project', 'forked', 'file.sql'));
|
||||
should(trimUri(projectUri, fileUri)).equal('../forked/file.sql');
|
||||
should(utils.trimUri(projectUri, fileUri)).equal('../forked/file.sql');
|
||||
|
||||
fileUri = Uri.file(path.join(root, 'forked', 'from', 'top', 'file.sql'));
|
||||
should(trimUri(projectUri, fileUri)).equal('../../forked/from/top/file.sql');
|
||||
should(utils.trimUri(projectUri, fileUri)).equal('../../forked/from/top/file.sql');
|
||||
});
|
||||
|
||||
it('Should remove $() from sqlcmd variables', () => {
|
||||
should(removeSqlCmdVariableFormatting('$(test)')).equal('test', '$() surrounding the variable should have been removed');
|
||||
should(removeSqlCmdVariableFormatting('$(test')).equal('test', '$( at the beginning of the variable should have been removed');
|
||||
should(removeSqlCmdVariableFormatting('test')).equal('test', 'string should not have been changed because it is not in sqlcmd variable format');
|
||||
should(utils.removeSqlCmdVariableFormatting('$(test)')).equal('test', '$() surrounding the variable should have been removed');
|
||||
should(utils.removeSqlCmdVariableFormatting('$(test')).equal('test', '$( at the beginning of the variable should have been removed');
|
||||
should(utils.removeSqlCmdVariableFormatting('test')).equal('test', 'string should not have been changed because it is not in sqlcmd variable format');
|
||||
});
|
||||
|
||||
it('Should make variable be in sqlcmd variable format with $()', () => {
|
||||
should(formatSqlCmdVariable('$(test)')).equal('$(test)', 'string should not have been changed because it was already in the correct format');
|
||||
should(formatSqlCmdVariable('test')).equal('$(test)', 'string should have been changed to be in sqlcmd variable format');
|
||||
should(formatSqlCmdVariable('$(test')).equal('$(test)', 'string should have been changed to be in sqlcmd variable format');
|
||||
should(formatSqlCmdVariable('')).equal('', 'should not do anything to an empty string');
|
||||
should(utils.formatSqlCmdVariable('$(test)')).equal('$(test)', 'string should not have been changed because it was already in the correct format');
|
||||
should(utils.formatSqlCmdVariable('test')).equal('$(test)', 'string should have been changed to be in sqlcmd variable format');
|
||||
should(utils.formatSqlCmdVariable('$(test')).equal('$(test)', 'string should have been changed to be in sqlcmd variable format');
|
||||
should(utils.formatSqlCmdVariable('')).equal('', 'should not do anything to an empty string');
|
||||
});
|
||||
|
||||
it('Should determine invalid sqlcmd variable names', () => {
|
||||
// valid names
|
||||
should(isValidSqlCmdVariableName('$(test)')).equal(true);
|
||||
should(isValidSqlCmdVariableName('$(test )')).equal(true, 'trailing spaces should be valid because they will be trimmed');
|
||||
should(isValidSqlCmdVariableName('test')).equal(true);
|
||||
should(isValidSqlCmdVariableName('test ')).equal(true, 'trailing spaces should be valid because they will be trimmed');
|
||||
should(isValidSqlCmdVariableName('$(test')).equal(true);
|
||||
should(isValidSqlCmdVariableName('$(test ')).equal(true, 'trailing spaces should be valid because they will be trimmed');
|
||||
should(utils.isValidSqlCmdVariableName('$(test)')).equal(true);
|
||||
should(utils.isValidSqlCmdVariableName('$(test )')).equal(true, 'trailing spaces should be valid because they will be trimmed');
|
||||
should(utils.isValidSqlCmdVariableName('test')).equal(true);
|
||||
should(utils.isValidSqlCmdVariableName('test ')).equal(true, 'trailing spaces should be valid because they will be trimmed');
|
||||
should(utils.isValidSqlCmdVariableName('$(test')).equal(true);
|
||||
should(utils.isValidSqlCmdVariableName('$(test ')).equal(true, 'trailing spaces should be valid because they will be trimmed');
|
||||
|
||||
// whitespace
|
||||
should(isValidSqlCmdVariableName('')).equal(false);
|
||||
should(isValidSqlCmdVariableName(' ')).equal(false);
|
||||
should(isValidSqlCmdVariableName(' ')).equal(false);
|
||||
should(isValidSqlCmdVariableName('test abc')).equal(false);
|
||||
should(isValidSqlCmdVariableName(' ')).equal(false);
|
||||
should(utils.isValidSqlCmdVariableName('')).equal(false);
|
||||
should(utils.isValidSqlCmdVariableName(' ')).equal(false);
|
||||
should(utils.isValidSqlCmdVariableName(' ')).equal(false);
|
||||
should(utils.isValidSqlCmdVariableName('test abc')).equal(false);
|
||||
should(utils.isValidSqlCmdVariableName(' ')).equal(false);
|
||||
|
||||
// invalid characters
|
||||
should(isValidSqlCmdVariableName('$($test')).equal(false);
|
||||
should(isValidSqlCmdVariableName('$test')).equal(false);
|
||||
should(isValidSqlCmdVariableName('$test')).equal(false);
|
||||
should(isValidSqlCmdVariableName('test@')).equal(false);
|
||||
should(isValidSqlCmdVariableName('test#')).equal(false);
|
||||
should(isValidSqlCmdVariableName('test"')).equal(false);
|
||||
should(isValidSqlCmdVariableName('test\'')).equal(false);
|
||||
should(isValidSqlCmdVariableName('test-1')).equal(false);
|
||||
should(utils.isValidSqlCmdVariableName('$($test')).equal(false);
|
||||
should(utils.isValidSqlCmdVariableName('$test')).equal(false);
|
||||
should(utils.isValidSqlCmdVariableName('$test')).equal(false);
|
||||
should(utils.isValidSqlCmdVariableName('test@')).equal(false);
|
||||
should(utils.isValidSqlCmdVariableName('test#')).equal(false);
|
||||
should(utils.isValidSqlCmdVariableName('test"')).equal(false);
|
||||
should(utils.isValidSqlCmdVariableName('test\'')).equal(false);
|
||||
should(utils.isValidSqlCmdVariableName('test-1')).equal(false);
|
||||
});
|
||||
|
||||
it('Should convert from milliseconds to hr min sec correctly', () => {
|
||||
should(timeConversion((60 * 60 * 1000) + (59 * 60 * 1000) + (59 * 1000))).equal('1 hr, 59 min, 59 sec');
|
||||
should(timeConversion((60 * 60 * 1000) + (59 * 60 * 1000))).equal('1 hr, 59 min');
|
||||
should(timeConversion((60 * 60 * 1000))).equal('1 hr');
|
||||
should(timeConversion((60 * 60 * 1000) + (59 * 1000))).equal('1 hr, 59 sec');
|
||||
should(timeConversion((59 * 60 * 1000) + (59 * 1000))).equal('59 min, 59 sec');
|
||||
should(timeConversion((59 * 1000))).equal('59 sec');
|
||||
should(timeConversion((59))).equal('59 msec');
|
||||
should(utils.timeConversion((60 * 60 * 1000) + (59 * 60 * 1000) + (59 * 1000))).equal('1 hr, 59 min, 59 sec');
|
||||
should(utils.timeConversion((60 * 60 * 1000) + (59 * 60 * 1000))).equal('1 hr, 59 min');
|
||||
should(utils.timeConversion((60 * 60 * 1000))).equal('1 hr');
|
||||
should(utils.timeConversion((60 * 60 * 1000) + (59 * 1000))).equal('1 hr, 59 sec');
|
||||
should(utils.timeConversion((59 * 60 * 1000) + (59 * 1000))).equal('59 min, 59 sec');
|
||||
should(utils.timeConversion((59 * 1000))).equal('59 sec');
|
||||
should(utils.timeConversion((59))).equal('59 msec');
|
||||
});
|
||||
|
||||
it('Should validate port number correctly', () => {
|
||||
should(validateSqlServerPortNumber('invalid')).equals(false);
|
||||
should(validateSqlServerPortNumber('')).equals(false);
|
||||
should(validateSqlServerPortNumber(undefined)).equals(false);
|
||||
should(validateSqlServerPortNumber('65536')).equals(false);
|
||||
should(validateSqlServerPortNumber('-1')).equals(false);
|
||||
should(validateSqlServerPortNumber('65530')).equals(true);
|
||||
should(validateSqlServerPortNumber('1533')).equals(true);
|
||||
should(utils.validateSqlServerPortNumber('invalid')).equals(false);
|
||||
should(utils.validateSqlServerPortNumber('')).equals(false);
|
||||
should(utils.validateSqlServerPortNumber(undefined)).equals(false);
|
||||
should(utils.validateSqlServerPortNumber('65536')).equals(false);
|
||||
should(utils.validateSqlServerPortNumber('-1')).equals(false);
|
||||
should(utils.validateSqlServerPortNumber('65530')).equals(true);
|
||||
should(utils.validateSqlServerPortNumber('1533')).equals(true);
|
||||
});
|
||||
|
||||
it('Should validate empty string correctly', () => {
|
||||
should(isEmptyString('invalid')).equals(false);
|
||||
should(isEmptyString('')).equals(true);
|
||||
should(isEmptyString(undefined)).equals(true);
|
||||
should(isEmptyString('65536')).equals(false);
|
||||
should(utils.isEmptyString('invalid')).equals(false);
|
||||
should(utils.isEmptyString('')).equals(true);
|
||||
should(utils.isEmptyString(undefined)).equals(true);
|
||||
should(utils.isEmptyString('65536')).equals(false);
|
||||
});
|
||||
|
||||
it('Should correctly detect present commands', async () => {
|
||||
should(await detectCommandInstallation('node')).equal(true, '"node" should have been detected.');
|
||||
should(await detectCommandInstallation('bogusFakeCommand')).equal(false, '"bogusFakeCommand" should have been detected.');
|
||||
should(await utils.detectCommandInstallation('node')).equal(true, '"node" should have been detected.');
|
||||
should(await utils.detectCommandInstallation('bogusFakeCommand')).equal(false, '"bogusFakeCommand" should have been detected.');
|
||||
});
|
||||
|
||||
it('Should validate SQL server password correctly', () => {
|
||||
should(isValidSQLPassword('invalid')).equals(false, 'string with chars only is invalid password');
|
||||
should(isValidSQLPassword('')).equals(false, 'empty string is invalid password');
|
||||
should(isValidSQLPassword('65536')).equals(false, 'string with numbers only is invalid password');
|
||||
should(isValidSQLPassword('dFGj')).equals(false, 'string with lowercase and uppercase char only is invalid password');
|
||||
should(isValidSQLPassword('dj$')).equals(false, 'string with char and symbols only is invalid password');
|
||||
should(isValidSQLPassword('dF65530')).equals(false, 'string with char and numbers only is invalid password');
|
||||
should(isValidSQLPassword('dF6$30')).equals(false, 'dF6$30 is invalid password');
|
||||
should(isValidSQLPassword('dF65$530')).equals(true, 'dF65$530 is valid password');
|
||||
should(isValidSQLPassword('dFdf65$530')).equals(true, 'dF65$530 is valid password');
|
||||
should(isValidSQLPassword('av1fgh533@')).equals(true, 'dF65$530 is valid password');
|
||||
should(utils.isValidSQLPassword('invalid')).equals(false, 'string with chars only is invalid password');
|
||||
should(utils.isValidSQLPassword('')).equals(false, 'empty string is invalid password');
|
||||
should(utils.isValidSQLPassword('65536')).equals(false, 'string with numbers only is invalid password');
|
||||
should(utils.isValidSQLPassword('dFGj')).equals(false, 'string with lowercase and uppercase char only is invalid password');
|
||||
should(utils.isValidSQLPassword('dj$')).equals(false, 'string with char and symbols only is invalid password');
|
||||
should(utils.isValidSQLPassword('dF65530')).equals(false, 'string with char and numbers only is invalid password');
|
||||
should(utils.isValidSQLPassword('dF6$30')).equals(false, 'dF6$30 is invalid password');
|
||||
should(utils.isValidSQLPassword('dF65$530')).equals(true, 'dF65$530 is valid password');
|
||||
should(utils.isValidSQLPassword('dFdf65$530')).equals(true, 'dF65$530 is valid password');
|
||||
should(utils.isValidSQLPassword('av1fgh533@')).equals(true, 'dF65$530 is valid password');
|
||||
});
|
||||
|
||||
it('findSqlVersionInImageName should return the version correctly', () => {
|
||||
should(findSqlVersionInImageName('2017-CU1-ubuntu')).equals(2017, 'invalid number returned for 2017-CU1-ubuntu');
|
||||
should(findSqlVersionInImageName('2019-latest')).equals(2019, 'invalid number returned for 2019-latest');
|
||||
should(findSqlVersionInImageName('latest')).equals(undefined, 'invalid number returned for latest');
|
||||
should(findSqlVersionInImageName('latest-ubuntu')).equals(undefined, 'invalid number returned for latest-ubuntu');
|
||||
should(findSqlVersionInImageName('2017-CU20-ubuntu-16.04')).equals(2017, 'invalid number returned for 2017-CU20-ubuntu-16.04');
|
||||
should(utils.findSqlVersionInImageName('2017-CU1-ubuntu')).equals(2017, 'invalid number returned for 2017-CU1-ubuntu');
|
||||
should(utils.findSqlVersionInImageName('2019-latest')).equals(2019, 'invalid number returned for 2019-latest');
|
||||
should(utils.findSqlVersionInImageName('latest')).equals(undefined, 'invalid number returned for latest');
|
||||
should(utils.findSqlVersionInImageName('latest-ubuntu')).equals(undefined, 'invalid number returned for latest-ubuntu');
|
||||
should(utils.findSqlVersionInImageName('2017-CU20-ubuntu-16.04')).equals(2017, 'invalid number returned for 2017-CU20-ubuntu-16.04');
|
||||
});
|
||||
|
||||
it('findSqlVersionInTargetPlatform should return the version correctly', () => {
|
||||
should(findSqlVersionInTargetPlatform('SQL Server 2012')).equals(2012, 'invalid number returned for SQL Server 2012');
|
||||
should(findSqlVersionInTargetPlatform('SQL Server 2019')).equals(2019, 'invalid number returned for SQL Server 2019');
|
||||
should(findSqlVersionInTargetPlatform('Azure SQL Database')).equals(undefined, 'invalid number returned for Azure SQL Database');
|
||||
should(findSqlVersionInTargetPlatform('Azure Synapse SQL Pool')).equals(undefined, 'invalid number returned for Azure Synapse SQL Pool');
|
||||
should(utils.findSqlVersionInTargetPlatform('SQL Server 2012')).equals(2012, 'invalid number returned for SQL Server 2012');
|
||||
should(utils.findSqlVersionInTargetPlatform('SQL Server 2019')).equals(2019, 'invalid number returned for SQL Server 2019');
|
||||
should(utils.findSqlVersionInTargetPlatform('Azure SQL Database')).equals(undefined, 'invalid number returned for Azure SQL Database');
|
||||
should(utils.findSqlVersionInTargetPlatform('Azure Synapse SQL Pool')).equals(undefined, 'invalid number returned for Azure Synapse SQL Pool');
|
||||
});
|
||||
|
||||
it('Should only return well known database strings when getWellKnownDatabaseSources function is called', async function (): Promise<void> {
|
||||
const sources = ['test1', 'test2', 'test3', constants.WellKnownDatabaseSources[0]];
|
||||
|
||||
(utils.getWellKnownDatabaseSources(sources).length).should.equal(1);
|
||||
(utils.getWellKnownDatabaseSources(sources)[0]).should.equal(constants.WellKnownDatabaseSources[0]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import * as extractZip from 'extract-zip';
|
||||
import * as constants from '../common/constants';
|
||||
import { HttpClient } from '../common/httpClient';
|
||||
import { DBProjectConfigurationKey } from './netcoreTool';
|
||||
import { ProjectType } from 'mssql';
|
||||
|
||||
const buildDirectory = 'BuildDirectory';
|
||||
const sdkName = 'Microsoft.Build.Sql';
|
||||
@@ -128,17 +129,17 @@ export class BuildHelper {
|
||||
return this.extensionBuildDir;
|
||||
}
|
||||
|
||||
public constructBuildArguments(projectPath: string, buildDirPath: string, isSdkStyleProject: boolean): string {
|
||||
public constructBuildArguments(projectPath: string, buildDirPath: string, sqlProjStyle: ProjectType): string {
|
||||
projectPath = utils.getQuotedPath(projectPath);
|
||||
buildDirPath = utils.getQuotedPath(buildDirPath);
|
||||
|
||||
// Right now SystemDacpacsLocation and NETCoreTargetsPath get set to the same thing, but separating them out for if we move
|
||||
// the system dacpacs somewhere else and also so that the variable name makes more sense if building from the commandline,
|
||||
// since SDK style projects don't to specify the targets path, just where the system dacpacs are
|
||||
if (isSdkStyleProject) {
|
||||
if (sqlProjStyle === ProjectType.SdkStyle) {
|
||||
return ` build ${projectPath} /p:NetCoreBuild=true /p:SystemDacpacsLocation=${buildDirPath}`;
|
||||
} else {
|
||||
return ` build ${projectPath} /p:NetCoreBuild=true /p:NETCoreTargetsPath=${buildDirPath}`;
|
||||
return ` build ${projectPath} /p:NetCoreBuild=true /p:NETCoreTargetsPath=${buildDirPath} /p:SystemDacpacsLocation=${buildDirPath}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user