0

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?

Nick
  • 58
  • 6
  • 1
    Side note: I strongly recommend naming your constraints; a name like `PK__tableName__9F5C806986DC991C` isn't meaningful to anyone. – Thom A Aug 11 '22 at 15:54
  • thank you for the comment. These are not the actual key names, I have anonymized all db object names in my post for privacy reasons. – Nick Aug 11 '22 at 15:55
  • How is this stored in your table's SQL file in the project? It should show up with something like ADD CONSTRAINT PK_xyz PRIMARY KEY CLUSTERED (column). If that's not in there in that manner, that could be a problem. Alternatively, if you make this into a Visual Studio project, does it show up properly? I know the ADS bits for this are still being worked on so this may be a bug or limitation w/ that part. – Peter Schott Aug 11 '22 at 19:18
  • @PeterSchott the issue is that it is appearning like that to be added to the prioject in the schema compare but not appearing in the list of changes to be staged when I click "Apply". This leads me to conclude that the issue is with the Azure Data Factory schema compare extension, specifically in its functionality to apply changes to be staged for the sqlproj – Nick Aug 18 '22 at 17:40

1 Answers1

1

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.

Nick
  • 58
  • 6