distal-attribute
distal-attribute
distal-attribute
distal-attribute

Create foreign keys

ssmitj posted 6 years ago in Feature discussion
Hi.
I am from a Microsoft background. Is there any way to create a FOREIGN key in the HeidiSQL gui??

Thank you
Sarel
ansgar posted 6 years ago
Not via GUI, you'll have to write the ALTER TABLE queries yourself. See the docs.
Ventzy posted 5 years ago
This GUI looks promising, but I am using FKs in almost every table... so without this feature it is hardly useful for me.

The ticket with FK GUI request (Issue #400) is older than a year... and that doesn't look promising :(
ansgar posted 5 years ago
Hehe, you're right, foreign keys are really missing. Should be the next feature I'll add, as it has most stars, after multiple query tabs which were added recently.
ansgar posted 5 years ago
Foreign keys were implemented recently, btw. See it in action in a developer build.

jomofrodo posted 5 years ago
awesome. Thanks.
kez posted 4 years ago
Hi folks,

I eventually managed to create a FOREIGN KEY in a Heidi SQL table.

Here is how I did it ;

1. Create your Primary keys. For me this was straight forward so I won't post how to do that here

2. To create your FOREIGN KEYS you need to change the table / engine type for each table from MyIASM to InnoDb. To do this Select the table on the right hand side then select the OPTIONS tab on the right hand side and change the engine from MyIASM to InnoDb for every table.

Thats it ... Now I hope you will find it eariear to create tables with foreign keys.

I am not a dB expert and am interested to know why MyIASM does not support FK though InnoDb does. IS FK really necessary in a dB, or is it just that FK is only supported in InnoDb in HeidiSQL ?

ansgar posted 4 years ago
InnoDB is the only engine which supports foreign key constraints. That has nothing to do with HeidiSQL itself.

Please login to leave a reply, or register at first.