Why does SqlPackage keep dropping and recreating constraints?
I sometimes see this when deploying via sqlpackager.exe:
Analyzing deployment plan (Complete)
Updating database (Start)
Updating database (Complete)
Successfully published database.
This happens everytime I publish, even though there have not been any changes.
Typically this is caused by Sql taking the create statement from SSDT and changing it, it does things like changes GETDATE to getdate and (0) to ((0)), to be honest I am not 100% sure what it will and won't change but my fix for this when I get it happening is to go to SSMS and script out the table and copy and paste the constraint back into SSDT, then deploy and it should stop.
An example is the extra parenthesis which get added,so if you take:
CREATE TABLE xxx ( id int not null, status int not null default (0));
When you deploy to Sql this ends up as:
CREATE TABLE xxx ( id int not null, status int not null default ((0)));
Who knows why it does this but it does, just remember script it back from SSMS and forget about it!