- This topic has 4 replies, 2 voices, and was last updated 17 years, 4 months ago by fenbers.
-
AuthorPosts
-
fenbersMemberI just upgraded to MyEclipseIDE on my Mac. I used your tutorial to create some foreign keys among a few tables. Generating DDL on the tables reveals the SQL that creates the foreign key constraints. In the
Indexes
tab of the
Table/Object Info
window, they appear, but in the
Foreign Keys
tab, they do not. Why not? Also, nothing in the Entity-Relationship diagram indicates no foreighn keys (i.e., no icons, not any blue lines connecting tables).
I took a peek at the DB from outside of Eclipse (using a browser-based PHPmyAdmin). This utility shows some of my foreign keys, but not all.
What am I doing incorrectly?
Mark
Loyal WaterMemberWhat version of MyEclipse are you using ? What tutorial are you following ?
fenbersMemberUsing MyEclipse 6.0, and whatever tutorial version was posted last night on the myeclipseide.com website. I assume this was for v6 also, because adding the foreign keys behaved exactly as the tutorial showed.
Mark
fenbersMemberMore info.
I tried this again just now, and after creating two new foreign key constraints, the regenerated DDL for the table shows that just regular indexes were created instead of foreign key data, like this: (Hopefully the backticks won’t cause a problem when this is posted…)
create table `pepdatabase`.`Alternates`(
`altid` int unsigned not null auto_increment,
`cid1` int unsigned default ‘0’ not null,
`cid2` int unsigned default ‘0’ not null,
primary key (`altid`)
);create unique index `PRIMARY` on `pepdatabase`.`Alternates`(`altid`);
create index `alternates_cid1_fk` on `pepdatabase`.`Alternates`(`cid1`);
create index `alternates_cid2_fk` on `pepdatabase`.`Alternates`(`cid2`);Mark
fenbersMemberI have been able to solve this on my own. It turns out that MySQL cannot have foreign key constraints with the myISAM engine — only with the InnoDB engine. So for any tables that define foreign keys or are the target of them, they first have to be converted to InnoDB type tables, first. Then, foreign keys are able to be created…
Mark -
AuthorPosts