所以我使用phpmyadmin创建mysql db。我已经制作了SQL脚本,运行它并且它很成功但是当我在phpmyadmin中转到db > designer
时,它们之间没有关系(线)。
然而,表上的索引显示它看起来像是连接的:
我做过的示例脚本:
CREATE TABLE IF NOT EXISTS location(
id INT NOT NULL AUTO_INCREMENT,
tiploc_code VARCHAR(20),
stanox INT(10),
crs_code CHAR(3),
description VARCHAR(30),
tps_description VARCHAR(30),
PRIMARY KEY (id)
);
我将该位置ID用作calling_points表中的外键
CREATE TABLE IF NOT EXISTS calling_points(
id INT NOT NULL AUTO_INCREMENT,
schedule INT,
calling_type INT,
location INT,
arrival TIME,
departure TIME,
passing TIME,
platform CHAR(4),
departure_line CHAR(3),
arrival_line CHAR(3),
engineering_alwc TIME,
pathing_alwc TIME,
performance_alwc TIME,
PRIMARY KEY (id),
FOREIGN KEY (schedule) REFERENCES schedule(id)
ON DELETE CASCADE
ON UPDATE CASCADE,
FOREIGN KEY (calling_type) REFERENCES calling_type(id)
ON DELETE CASCADE
ON UPDATE CASCADE,
FOREIGN KEY (location) REFERENCES location(id)
ON DELETE CASCADE
ON UPDATE CASCADE
);
这是正常的吗?