-1

I am trying to create some tables in HeidiSql, but got stuck at the point I noticed that I can not create foreign keys. At first I tried it with SQL statements and later on with the key generation menu of HeidiSql. Both ended in giving me an index instead of a foreign key for the specified column.

Here is an example:

CREATE TABLE Test(
testId INT NOT NULL,
PRIMARY KEY(testId));

CREATE TABLE secondTest(
secondTestId INT NOT NULL,
test INT NOT NULL,
FOREIGN KEY(test) REFERENCES Test(testId),
PRIMARY KEY(secondTestId));

I do not get any error message, all it does is converting the foreign key, the symbol of the foreign key shows up until I save the table, into a index. Furthermore, it does not apply check constraints if specify one for a column. Has anyone faced the same problem yet? Thank you for your help!

1 Answers1

0

Seems like the engine was the problem. Changed it from 'MyIsam' to 'InnoDB' and it creates the constraints and keys now as it should.

Mureinik
  • 297,002
  • 52
  • 306
  • 350