Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement foreign key constraints. #4

Open
kinda-raffy opened this issue Mar 23, 2024 · 0 comments
Open

Implement foreign key constraints. #4

kinda-raffy opened this issue Mar 23, 2024 · 0 comments

Comments

@kinda-raffy
Copy link

Hi @isaac-mcfadyen,

Love your work!

Correct me if I'm wrong, but it seems like the database driver has no conception of foreign keys in the databases, right?

For example, the Locality table should hold a foreign key to the Region table via the attribute regionId. But the driver only seems to pick up the primary key only:

image

It also fails to produce any edges between the two tables in the diagram viewer:

image

For clarity, here is the SQL code that created these tables:

CREATE TABLE `Region` (
	`regionId` text PRIMARY KEY NOT NULL,
	`regionName` text NOT NULL
);

CREATE TABLE `Locality` (
	`localityId` text PRIMARY KEY NOT NULL,
	`localityName` text NOT NULL,
	`regionId` text NOT NULL,
	FOREIGN KEY (`regionId`) REFERENCES `Region`(`regionId`) ON UPDATE cascade ON DELETE cascade
);

I understand that there is an issue with showing foreign keys and I'm willing to code up a solution to this. Before I get started, could you please point me in the right direction?

Thanks,
Raf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant