sqlpackage excluded type missing schema

Christopher Mire 1 Reputation point
2022-08-18T20:10:28.02+00:00

sqlpackage.exe doesnt have a way to specify to ignore schema's. If I pass /p:DropObjectsNotInSource=True it wants to drop all schemas outside my dacpac when publishing. For example it generates this if I am deploying a dacpac that does not have "CREATE SCHEMA [abc]]" defined
PRINT N'Dropping SqlSchema [abc]...';
DROP SCHEMA [abc];
GO
There is no type I can pass to p:DoNotDropObjectTypes to have it not drop these.

If list of types can not be adjusted to have schema, maybe an additional flag can be added like "DropSchemasNotInSource=(BOOLEAN)". I have checked Microsoft.SqlServer.Dac.ObjectType and there is no value for Schema currently.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,757 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Tom Phillips 17,716 Reputation points
    2022-08-19T17:31:40.547+00:00

    There is no way to do what you are describing in SSDT deployments. The project expects all objects to exist in the project, or not. There is not a way to specify some should and others should be removed.


  2. Mire, Chris 1 Reputation point
    2022-08-24T13:02:45.133+00:00

    I have found following enhancement request on DacFX repo which matches what I need.

    https://github.com/microsoft/DacFx/issues/24

    0 comments No comments