microsoft / microsoft/DacFx

When using DoNotDropObjectTypes argument, sqlpackage ignores DropIndexesNotInSource=false

Open
#403 2 comments 0 reactions 1 assignee Claimed by @dzsquared View on GitHub
bug documentation
Dominant language
C#
Stars
460
Forks
29
Avg merge
4d 9h
Merged PRs (30d)
7

Description

We use azure sql tuning advisor to apply indexes it sees as beneficial. As such our db structure in our solution isn't always in sync with what's in the target schema.

We attempted to use the "DropIndexesNotInSource" argument set to false to prevent the azure generated indexes from being dropped before we have a time to analyze them and internalize them into our solution.

Based on the documentation we've found, it does not seem like indexes is an accepted value for passing to the "DoNotDropObjectTypes" argument.
Arg list
``/Action:Publish ` ``
``/SourceFile:$dacpacPath ` ``
``/TargetConnectionString:$connString ` ``
``/V:Configuration=$publishConfig ` ``
``/p:BlockOnPossibleDataLoss=false ` ``
``/p:NoAlterStatementsToChangeCLRTypes=true ` ``
``/p:DeployDatabaseInSingleUserMode=false ` ``
``/p:IncludeTransactionalScripts=$includeTransactionalScripts` ``
``/p:CreateNewDatabase=false ` ``
``/p:BackupDatabaseBeforeChanges=false ` ``
``/p:DropObjectsNotInSource=true ` ``
``/P:DropIndexesNotInSource=false ` ``
``/p:ScriptDatabaseCompatibility=true ` ``
``/p:ScriptDatabaseOptions=true ` ``
``/p:IgnoreFileAndLogFilePath=true ` ``
``/p:IgnoreFillFactor=true ` ``
``/p:IgnoreUserSettingsObjects=true ` ``
``/p:AllowIncompatiblePlatform=true ` ``
``/p:DoNotDropObjectTypes=$objectTypesToKeep ` ``
``/p:IgnoreColumnOrder=true ` ``
``/p:CommandTimeout=1200 ``

But what we end up seeing is the indexes being dropped anyway:

2020-06-15T05:00:48.7683713Z Dropping [account].[AccountHolder].[nci_wi_AccountHolder_B9027D8081748BB108F9F00BEB10DE87]...
2020-06-15T05:00:48.7984403Z Dropping [account].[Ledger].[nci_wi_Ledger_428E9D816F0FE79354607E484490B20A]...
2020-06-15T05:00:48.8257682Z Dropping [account].[Ledger].[nci_wi_Ledger_6D80D088BFFD5AE25F144BABD15B1A40]...
2020-06-15T05:00:48.8526572Z Dropping [account].[Ledger].[nci_wi_Ledger_6E25B19DFA6E3BB8967B5726B270DB17]...
2020-06-15T05:00:48.8791748Z Dropping [account].[Note].[nci_wi_Note_8B5E0B53408FB1FB6F82EF7A7EA270FE]...
2020-06-15T05:00:48.9059037Z Dropping [claim].[ClaimHistory].[nci_wi_ClaimHistory_CF1A71F321501BAD2004E62F3192F48F]...
2020-06-15T05:00:48.9322502Z Dropping [class].[VINMaster].[nci_wi_VINMaster_D3AFEE5A69AD073E60392DDEE8BDE6BC]...
2020-06-15T05:00:48.9589680Z Dropping [contract].[Contract].[nci_wi_Contract_50476B2C852EE5C7E3B3E7CF2EB6AB98]...
2020-06-15T05:00:48.9856878Z Dropping [contract].[Contract].[nci_wi_Contract_7E4E65F5E25E6513116DEB3EFCC250AA]...
2020-06-15T05:00:49.0124444Z Dropping [contract].[Contract].[nci_wi_Contract_8C185D570D064D556F7182700139EB3F]...
2020-06-15T05:00:49.0387907Z Dropping [contract].[Contract].[nci_wi_Contract_901FCDCDD84F918D585710F2AA5C827B]...
2020-06-15T05:00:49.0670467Z Dropping [contract].[ContractDisbursement].[nci_wi_ContractDisbursement_D5625CDF24A25C52627E9CCAFDCF12C9]...
2020-06-15T05:00:49.0933761Z Dropping [contract].[HoldDisbursement].[nci_wi_HoldDisbursement_5BA3E741687E9D908ED219534ADAD32B]...
2020-06-15T05:00:49.1188825Z Dropping [contract].[HoldDisbursement].[nci_wi_HoldDisbursement_707969C363B517A7E0D9E28839640333]...

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.