Closed martinsmith123456 closed 1 week ago
Can I know if your changes worked or you found a better way to handle this situation? Please let me know. Thank you.
Wow I found this project because I wanted to exclude a specific schema during deployment and noticed the same thing as mentioned above. The generated script still lists the sections for "Dropping unnamed constraint" that reference (in my case default values) for fields in tables from the schema I want to exclude. So I would still have lost something from the tables in the schema I want to be left alone. This was with the DLL release 1.4.4.1 the latest as of now from Mar 8 2019.
P.S. Coming from handcrafted sql scripts and generating bacpac from a VS SQL Database project and using sqlpackage to deploy upgrades to customer databases still feels like a very fragile solution.
This can be reproduced as follows.
The test will now fail as it tried to run an ALTER TABLE adding a default to a table that does not exist.
The issue is that the name for these is blank so attempting to extract the schema from the name does not work.
I can't see a nice way of fixing this though.
In the immediate window extracting the schema name from
((Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlTable)((Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlDefaultConstraint)((CreateElementStep)step).SourceElement.ContextObject).DefiningTable).Schema.Name.Parts[0]
would work but this would need reflection to access in the code itself as these are not all public.
Maybe I will resort to parsing it out of the CreateElementStep.Message
Any better suggestions?