Есть две таблицы: | Код | create table office(id int not null auto_increment, name varchar(255), comment varchar(255), primary key(id), unique index(name)) engine=InnoDB; create table catalog(id_ref int not null, id int not null auto_increment, name varchar(255), path varchar(255), comment varchar(255), category varchar(255), primary key(id), foreign key(id_ref) references office(id)) engine=InnoDB;
|
Таблица catalog пустая. А при попытки удаления строки из таблицы office возникает ошибка :( | Код | Cannot delete or update a parent row: a foreign key constraint fails (`db_work\/catalog`, CONSTRAINT `catalog_ibfk_1` FOREIGN KEY (`id_ref`) REFERENCES `office` (`id`))
|
Как с этим бороться? С внешними ключами начал работать недавно совсем.
|