Create foreign keys

[expired user #3646]'s profile image [expired user #3646] posted 16 years ago in Feature discussion Permalink
Hi.
I am from a Microsoft background. Is there any way to create a FOREIGN key in the HeidiSQL gui??

Thank you
Sarel
ansgar's profile image ansgar posted 16 years ago Permalink
Not via GUI, you'll have to write the ALTER TABLE queries yourself. See the docs.
[expired user #4182]'s profile image [expired user #4182] posted 15 years ago Permalink
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's profile image ansgar posted 15 years ago Permalink
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's profile image ansgar posted 15 years ago Permalink
Foreign keys were implemented recently, btw. See it in action in a developer build.
[expired user #4644]'s profile image [expired user #4644] posted 14 years ago Permalink
awesome. Thanks.
kez's profile image kez posted 13 years ago Permalink
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's profile image ansgar posted 13 years ago Permalink
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.