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

Create foreign keys

User, date Message
Written by ssmitj
6 years ago
Category: Feature discussion
1 posts since Fri, 08 Aug 08
Hi.
I am from a Microsoft background. Is there any way to create a FOREIGN key in the HeidiSQL gui??

Thank you
Sarel
Written by ansgar
6 years ago
5015 posts since Fri, 07 Apr 06
Not via GUI, you'll have to write the ALTER TABLE queries yourself. See the docs.
Written by Ventzy
5 years ago
3 posts since Wed, 12 Aug 09
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 :(
Written by ansgar
5 years ago
5015 posts since Fri, 07 Apr 06
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.
Written by ansgar
5 years ago
5015 posts since Fri, 07 Apr 06
Foreign keys were implemented recently, btw. See it in action in a developer build.
Written by jomofrodo
5 years ago
1 posts since Sat, 23 Jan 10
awesome. Thanks.
Written by kezMoney, Euro
4 years ago
21 posts since Tue, 21 Sep 10
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 ?

Written by ansgar
4 years ago
5015 posts since Fri, 07 Apr 06
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.