Home

Missing foreign key relationship

Hi everyone! This one has me scratching my head. One of my tables is missing its FK relationship in LinqPad, and so I have to do my joins manually. I've had this issue before, and it turned out the table needed a synthetic ID to work with Linq2SQl, but that's not the case here.

CREATE TABLE tools.PackageReleaseMetadata (
[PackageMetadataId] INT NOT NULL IDENTITY (1,1),
[AppId] INT NOT NULL REFERENCES [apps].[App] (AppId),

We'd expect to see an Apps reference when dotting off of the PackageReleaseMetadata object, but no such luck, I just see the AppId field. I verified with sp_help that the table does indeed contain that FK reference. Any ideas what else I can try?

Comments

  • As is the way of things I figured it out soon after posting this. Though we have a synthetic key on that table, the primary key is actually a composite key, made up of multiple fields. I'll probably address this by changing the synthetic key to be the PK and reducing the composite PK to a unique constraint
Sign In or Register to comment.