Book a Demo

Author Topic: foreign key columns not getting generated  (Read 3740 times)

Tim Friest

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
foreign key columns not getting generated
« on: June 21, 2011, 04:22:59 am »
Upgrading to EA 9 has introduced a problem with my generated DDL file.

I'm generating DDLs for SQL-Server.

I have associative tables where there are 2 foreign key columns to the same table.
The generated ddl is dropping the second column, but it adds the fk constraint for it (I reordered them and it isn't something specific to the column, it seems to think the second one is a duplicate or something).

For example, suppose I have a table A and a table A_ASSOC where A_ASSOC has columns subject_a and object_a...
The DDL is creating the A_ASSOC table, but only the subject_a column is getting created.  It is then doing an add constraint for both columns to table A...

There are no compound keys, so all the pks and fks are single columns.

Tables with multiple associations (to different tables) seem to work, it is just if there are multiple associations to the same table.

it was working in 7.1

Tim Friest

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: foreign key columns not getting generated
« Reply #1 on: June 25, 2011, 02:05:08 am »
I was trying to create a simple example of the problem.
When I create a simple 2 table model it seemed to work and generate correctly, but then after closing the project and re-opening it, the fks are messed up.

In my simple example, the columns get generated, but the fk constraints are not getting generated (after closing and reopening the project).

I don't see how to link in the diagram, but basically it is one parent table with 1 pk column and one child table with 3 columns (pk, fk1, fk2).   There are 2 associations one with the fk1 marked as the fk and one with the fk2.
When I create it, the fk_ methods show in the second class and the columns get the FK notation to the left, but then after reloading the project, the fk_ methods are gone and the FK notation on the left of the fk1 and fk2 columns is also gone.  The associations are still there but they don't have the little (fk1 = pk) or (fk2 = pk) labelling...

I still haven't figured out why my simple example works differently than the full (hundreds of tables) model I started with.

I'm running build 906.