1 person found this helpful
Usually when I have seen this it is because you put an attribute in the child entity (in the logical model) to represent the future FK column that is inferred by the relationship. In Data Modeler, the forward engineering will automatically take the PK column(s) from the parent entity and cascade it forward into the child. Hence you get attribute_1 in the engineered table as it appears to be a duplicate column name.
If you switch the diagramming style in the logical model from Barker notation to either IE or IDEF, you will see the issue. Barker notation, as a standard, does not show the inherited attributes in the logical model, but they are there behind the scenes. The other two styles show then so the logical model looks more like the relational tables that will result after the forward engineering occurs.
So the solution is to go back to your logical model and delete the attribute in the child entity then run your forward engineer.
Thanks Kent. I changed the notation and I can indeed see the child field in the logical model now. The problem is that there doesn't appear to be a duplicate field in the logical. The logical looks fine with only the one child field that is associated to the relationship. (I can't delete it unless I remove the relationship)
But then when I engineer to the relational model I still get the duplicate fields...
1 person found this helpful
Odd. So back in Barker notation - do you see the field there? (If so delete that one).
Did you delete the relational table and try a fresh forward engineer? Forward engineering does not usually delete objects that are already there but will update the relational structure instead (so maybe the duplicate is an artifact of an earlier effort?)
My only other thought would be to look carefully at all the various tabs in the forward engineer dialog to see if there is another clue - like an extra relationship or something?
Thanks Kent. In Barker notation the field isn't there. So everything is good in the Logical.
Your thought about deleted the relational table worked. I took it a step farther and regenerated the entire relational model. That works great! I am able to engineer relationships now...maybe something got messed up in the relational model...
But, I then lose the db scripts I have added per table in the relational model. Do you know of anyway to transfer scripts between relational models?
What do you mean by db scripts? Had you attached something to the before or after create tabs?
Are they standardized or custom per table? If they are per table you *might* be able to write a custom transformation script (under Tools--> Design Rules) to copy them between the models (like the Copy Comments to Comments in RDBMS script, but with different object calls etc). Not an expert in this area. Either Philip or David are better to answer that one.
(BTW - being able to have multiple relational models in on design is a nice feature)
Yea, different DB scripts that populate the tables with reference data. Seemed like a good idea at the time...
I looked at the copy comments scripts but I'm afraid I don't know enough to code them. Is there a document available that lists the available methods and attributes?
Documentation is here: \datamodeler\xmlmetadata\doc