ErikEJ / SqlCeToolbox

SQLite & SQL Server Compact Toolbox extension for Visual Studio, SSMS (and stand alone)
Other
847 stars 174 forks source link

Toolbox is not using FK names set in SQLite database #932

Closed TheKrowi closed 2 years ago

TheKrowi commented 2 years ago

Database used is SQLite.

Take the following table and notice the named FK FK_GeneralSettings_CommandBitType.

CREATE TABLE "GeneralSettingsCommandBitTypes" (
    "GeneralSettingId"  INTEGER NOT NULL,
    "BitTypeId" INTEGER NOT NULL,
    FOREIGN KEY("GeneralSettingId") REFERENCES "GeneralSetting"("Id"),
    CONSTRAINT "FK_GeneralSettings_CommandBitType" FOREIGN KEY("BitTypeId") REFERENCES "BitType"("Id"),
    PRIMARY KEY("GeneralSettingId","BitTypeId")
);

When refreshing the table or adding the connection again in the toolbox, auto generated FK names are used (see image).

image

I would expect the toolbox to use the FK name instead of creating one itself.

ErikEJ commented 2 years ago

Please share a sample file

TheKrowi commented 2 years ago

Drives.zip

ErikEJ commented 2 years ago

No reliable way of extracting the names: https://stackoverflow.com/questions/41595152/how-to-get-the-names-of-foreign-key-constraints-in-sqlite