sql-serverdatabase-projectazure-data-studioschema-comparesqlproj

Add Primary Key Constraint keeps appearing in schema compare but won't commit to the database project


I am working on a database project in azure data studio. I added a primary key constraint to an existing table. When I update the project from the database, the schema compare picks up on the change.

+ALTER TABLE [dbo].[tableName]
+ [PK__tableName__9F5C806986DC991C] PRIMARY KEY CLUSTERED ([keyName] ASC);
+GO

Yet when I stage change and commit it, I do not see the change in my database proj, and it comes up in future schema compares. Is it possible this Alter statement is stored in some form in the dacpac? Should I drop and recreate tables when I need include PK and FK constraints?


Solution

  • Updating the SQL Server schema compare extension for Azure Data Factory to version 1.15.0 seems to have resolved this issue. The constraint is being picked up in the schema compare (as it always was) and is correctly being added to the list of changes to be staged and committed under the project explorer, when "Apply" is selected in the schema compare window.