Toad World® Forums

Duplicate forein keys


#1

A collegue of mine did not like CS2, because when he tried it, duplicate foreign keys were reverse enineered from whi database. I showed him TDM3 beta and it was the same there.

Weird, because it did not happen to me beofre, something like that.

Few minutes ago, I discovered that it was not a problem of CS2/TDM3, but instead MySQL reported those foreign keys multiple times.

DB dump…

– phpMyAdmin SQL Dump
– version 2.7.0-pl2
http://www.phpmyadmin.net

– Hostiteľ: localhost
– Vygenerované:: 08.Sep, 2007 - 22:46
– Verzia serveru: 4.1.20
– Verzia PHP: 5.2.3

– Databáza: wg


CREATE TABLE…


– Obmedzenie pre exportované tabuľky


– Obmedzenie pre tabuľku svr_hubs

ALTER TABLE svr_hubs
ADD CONSTRAINT svr_hubs_ibfk_1 FOREIGN KEY (id) REFERENCES svr_devices (id),
ADD CONSTRAINT svr_hubs_ibfk_2 FOREIGN KEY (id) REFERENCES svr_devices (id),
ADD CONSTRAINT svr_hubs_ibfk_3 FOREIGN KEY (id) REFERENCES svr_devices (id) ON DELETE CASCADE ON UPDATE CASCADE;

CS2 nor TDM3 reported this as an error and imported all three forein keys to the same column.

Correct me if I am wrong, but when making a model from scratch, I do not know how this could be achieved. That’s why reverse engineerin should not produce this either.

see attached image

dupl1.jpeg


#2

Hello,

It is loaded in TDM just as it is in your database.

Correct me if I am wrong, but when making a model from scratch, I do not know how this could be achieved.

Please see the attachment.

If you have more questions, please write me back. Thanks.

Regards,

Vladka
FK_Mapping.doc (24.5 KB)