I have an existing database with everything in schema dbo
. I have an SSDT project with objects I am adding to it with schema foo
I have a table that looks like this in the project:
CREATE table foo.a (
id INT NOT NULL
CONSTRAINT [PK_foo_a] PRIMARY KEY CLUSTERED
CONSTRAINT [FK_foo_a] FOREIGN KEY REFERENCES [dbo].[a],
desc NVARCHAR(50) NOT NULL
)
It depends on dbo.a. dbo.a has many columns that are foreign keys to other columns. Someone else (who maintains the default schema) might change dbo.a.
I'd like to simple store dbo.a as:
CREATE table dbo.a (
id INT NOT NULL
CONSTRAINT [PK_a] PRIMARY KEY CLUSTERED
)
So it gets built internally, but not deployed. Is that possible?
Best Answer
You can use the AgileSqlClub SqlPackage Deployment Filter.
Brief instructions reproduced from the original article by Ed Elliott:
DLL
into the same folder assqlpackage.exe
Add these command line parameters to your deployment:
/p:AdditionalDeploymentContributors=AgileSqlClub.DeploymentFilterContributor
/p:AdditionalDeploymentContributorArguments="SqlPackageFilter=IgnoreSchema(BLAH)"
This will neither deploy, drop or alter anything in the
BLAH
schema.See the original article for complete details.