我只是无法创建外键,我执行 SQL,它在控制台中显示成功,但是什么也没有发生
编辑
SQL代码
ALTER TABLE cotacaoitens
ADD CONSTRAINT fk_cotacaoitens_cotacao
FOREIGN KEY (codigoconcentrador, codigoempresa, codigocotacao) REFERENCES cotacao (codigoconcentrador, codigoempresa, codigocotacao) ON DELETE CASCADE;
成功消息
ALTER TABLE cotacaoitens
ADD CONSTRAINT fk_cotacaoitens_cotacao
FOREIGN KEY (codigoconcentrador, codigoempresa, codigocotacao) REFERENCES cotacao (codigoconcentrador, codigoempresa, codigocotacao) ON DELETE CASCADE
[2018-01-03 15:27:04] completed in 110ms
最佳答案
MyISAM doesn't support foreign keys, but it won't give an error either. It just ignores the request to create the foreign key. It says, "La la la I'm not listening" and puts its fingers in its ears.
I contributed to a good checklist for foreign key errors in this question: MySQL Creating tables with Foreign Keys giving errno: 150 Please read through the checklist and see if any of them apply to your case.
比尔·卡尔文
关于mysql - 无法在 PhpStorm 中创建外键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48082318/