Re: Parse-Dia-SQL foreign key



On Thu, May 28, 2015 at 10:40 PM,  <paul hermeneutic gmail com> wrote:
I created two UML classes (tables) and gave each several attributes (columns).

I created an association between them, but the foreign key is never
created in the SQL unless I make it the primary key of the one-side
table.

Is there a better place to ask Parse-Dia-SQL questions?


Hi Paul,

Which version of dia2code are you using? There is a dia2code list IIRC
and I made some patches to the SQL module some time ago. But there was
a bit of a glitch between 0.8.4 and 0.8.5 which I have never come
round to fix but is a perfect time for me to recheck this and also do
some work on DIA which I have put aside for far too long.

The sql converter uses the direction of the association. The pk and fk
columns need to follow the "surrogate key" convention where the fk
field needs to be named foo_id and always point to the pk of the other
table which must of course be named id. The name of the association is
also important. I will try to post some complex examples on the
dia2code web site. The pk is determined by setting "class scope" to
the pk attribute or attributes (it supports multiple attribute pk)

DIA and dia2code is REALLY powerful and we use it on a daily basis. I
have maintained complex models for Pg with hundreds of tables. Maybe
we have an old project somewhere that is no longer active and I can
publish the whole process.

Anyway, is a perfect opportunity for me to retake some of this work
and maybe fix the small issues in 0.8.5

Best,

Alex


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]