microsoft / microsoft/vscode-mssql

[Bug]: Schema compare - not reading clustered PK from DACPAC

Open
#21,889 0 comments 0 reactions 1 assignee Claimed by @aasimkhan30 View on GitHub
Area - Schema Compare Bug User-filed
Dominant language
TypeScript
Stars
1.9k
Forks
610
Avg merge
2d 3h
Merged PRs (30d)
97

Description

### Description

I'm comparing DACPAC (taken from database) to SQL project, and none of the tables in source have PK read correctly.
DACPAC
`CREATE TABLE [dbo].[__repl_SubscriptionArticle] (
[IDSubscriptionArticle] INT NOT NULL,
[SubscriptionID] INT NOT NULL,
[ArticleID] INT NOT NULL,
[generation] ROWVERSION NOT NULL
);`

Source:
`CREATE TABLE [dbo].[__repl_SubscriptionArticle] (
[IDSubscriptionArticle] INT NOT NULL,
[SubscriptionID] INT NOT NULL,
[ArticleID] INT NOT NULL,
[generation] ROWVERSION NOT NULL,
CONSTRAINT [PK___repl_SubscriptionArticle] PRIMARY KEY CLUSTERED ([IDSubscriptionArticle] ASC)
);`

Schema compare in VS2026 reads PK constraint correctly.
All default options on schema compare both in VS Code and VS2026.
I have search for relevant options, but they are all enabled (for comparing keys).

Is VS2026 and MSSQL extension calling same code underneath?

### Steps to Reproduce

1. Extract DACPAC from existing database
2. Compare it to source code
3. PK constraints are missing from MSSQL VS Code extension (they are actually showing in VS 2026 schema compare)

### Affected Area

- [ ] Connection dialog (SQL Server | Azure browse/Fabric browse)
- [ ] Query editor
- [ ] Query results panel
- [ ] Object Explorer
- [ ] GitHub Copilot integration
- [ ] Preview/Edit data
- [ ] Table Designer
- [ ] Schema Designer
- [x] Schema Compare
- [ ] Local SQL Server Container provisioning
- [ ] SQL database in Fabric provisioning
- [ ] DACPAC/BACPAC export/import
- [ ] SQL Database projects
- [ ] Query Plan Visualizer
- [ ] Other (please describe below)

### If you selected "Other", please describe the affected area

_No response_

### Environment Information

VS Code Version: 1.115.0
MSSQL extension version: 1.41.0
OS Version: Windows 11

### Confirmation

- [x] I have searched existing issues and couldn't find a match
- [ ] I want to work on this issue

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.