Home
Options

Multiple Tables with Foreign Keys to Same Table

Hello,

I have a sqlite DB (a migration from .net) that has two tables with FK constraints to the same table. Essentially the following schema:


CREATE TABLE "A" (
"Id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"CId" INTEGER,
CONSTRAINT "FK_A_C_CId" FOREIGN KEY("CId") REFERENCES "C"("Id") ON DELETE RESTRICT
);
CREATE TABLE "B" (
"Id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"CId" INTEGER,
CONSTRAINT "FK_B_C_CId" FOREIGN KEY("CId") REFERENCES "C"("Id") ON DELETE RESTRICT
);
CREATE TABLE "C" (
"Id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT
);

LINQPad 6.8.3 only recognizes one of the two navigation properties (whichever one it reads first it looks like). In the above example it shows the relationship from A to C and from C to A but not from B to C or C to B. It looks like I'm hitting a name conflict I've seen mentioned in other posts.

Is this intentional? If not, is it fixed in an upcoming release? Thanks a lot.

-Igor

Comments

Sign In or Register to comment.