Dette er sandsynligvis fordi du har navngivet mindst én begrænsning med samme identifikator som en kolonne:
/* You already have a column named `restaurant` in this table,
but are naming the FK CONSTRAINT `restaurant` also... */
CONSTRAINT `restaurant`
FOREIGN KEY (`restaurant` )
REFERENCES `mydb`.`restaurants` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
Skal bruge en anden identifikator for begrænsningen som fk_restaurant
som i :
CONSTRAINT `fk_restaurant`
FOREIGN KEY (`restaurant` )
REFERENCES `mydb`.`restaurants` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
Og det samme i food
tabel:
/* Name it fk_food */
CONSTRAINT `fk_food`
FOREIGN KEY (`food` )
REFERENCES `mydb`.`food` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
/* Name it fk_restaurant */
CONSTRAINT `fk_restaurant`
FOREIGN KEY (`restaurant` )
REFERENCES `mydb`.`restaurants` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
Det er de eneste tre, jeg ser, men der kunne være andre, jeg savnede.