NotMyself / Simple.Data.Sqlite

A Sqlite Provider for Simple.Data
17 stars 14 forks source link

Fix for foreign key constraints where the master and detail column names are not the same #13

Closed Lomster closed 2 years ago

Lomster commented 11 years ago

I've updated the schema provider to correctly output foreign keys where the column name in the master and the detail table aren't the same.

e.g.
CREATE TABLE [a] ([aID] INTEGER NOT NULL PRIMARY KEY...); CREATE TABLE [b] (..., [aID] INTEGER REFERENCES [a]([aID])...); OK

CREATE TABLE [a] ([Id] INTEGER NOT NULL PRIMARY KEY...); CREATE TABLE [b] (..., [a] INTEGER REFERENCES [a]([Id])...); NOT OK

Also updated TestForeignKeys to test this using a new table ForeignKeyTest in Northwind.db