Quantcast
Channel: MySQL Forums - MySQL Workbench
Viewing all articles
Browse latest Browse all 3737

DB->forward engineer misses fk's but reports success (no replies)

$
0
0
Hello eveybody.
I was modeling a moderately complex db structure and happened to notice (Quite late) that when I fw engineer it many tables loose some or all of their FKs I am looking into the reasons but am hitting air atm.

The thing is that when you do fw-eng the model into a db you don't get any feedback that something might have gone wrong. It was only when my model generator (yii->Gii) started missing relations that I found out.

One partial script, wb created, that should have run fine but failed to create FKs is this:


CREATE TABLE IF NOT EXISTS `db`.`text` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`article_id` INT UNSIGNED NOT NULL ,
`lang_id` INT UNSIGNED NOT NULL ,
`title` VARCHAR(128) NOT NULL ,
`title_uri_safe` VARCHAR(128) NOT NULL ,
`body` TEXT NOT NULL ,
`date_c` INT UNSIGNED NOT NULL ,
`date_u` INT UNSIGNED NOT NULL ,
`date_d` INT UNSIGNED NOT NULL ,
`deleted` TINYINT(1) NOT NULL DEFAULT FALSE ,
`is_note` TINYINT(1) NOT NULL DEFAULT FALSE ,
`creator_id` INT UNSIGNED NOT NULL ,
`last_editor_id` INT UNSIGNED NOT NULL ,
`owner_id` INT UNSIGNED NOT NULL ,
PRIMARY KEY (`id`) ,
CONSTRAINT `fk_text_creator`
FOREIGN KEY (`creator_id` )
REFERENCES `db`.`alias` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_text_last_editor`
FOREIGN KEY (`last_editor_id` )
REFERENCES `db`.`alias` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_text_owner`
FOREIGN KEY (`owner_id` )
REFERENCES `db`.`alias` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_text_lang`
FOREIGN KEY (`lang_id` )
REFERENCES `db`.`language` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_text_belongs_to_article`
FOREIGN KEY (`article_id` )
REFERENCES `db`.`article` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB,
COMMENT = 'text objects used by user, project, article' /* comment truncated */ ;


WB version: 5.2.34 (7780)
Linux F14
mysql 5.1.58

Viewing all articles
Browse latest Browse all 3737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>