BUG? Association, Foreign key, Sync is broken? (Model --> Database)

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
RobertK
Posts: 111
Joined: Thu 02 Mar 2017 05:44

BUG? Association, Foreign key, Sync is broken? (Model --> Database)

Post by RobertK » Mon 10 Apr 2017 05:46

Entity Developer v6.1.215
Tested using Postgres, this issue may occur in other database engines as well (untested).

How to reproduce issue
PgAdmin
1) Create two tables (do not add foreign key)

Entity Developer
2) Open Entity Developer and import the tables (Database --> Model)
3) Add an association
4) Update the database (Model --> Database)

In step #4, you will notice that Entity Developer is unable to detect that the new association/foreign key relationship you just created in Entity Developer does not yet exist in the physical database, now the model and the database is out of sync (the models are not the same as the database tables, its different!)

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: BUG? Association, Foreign key, Sync is broken? (Model --> Database)

Post by Shalex » Mon 10 Apr 2017 11:37

If your model is Devart Entity Model (*.edml), you should run Regenerate Storage and Mapping to create FK in SSDL basing on the new association in CSDL.

In case this doesn't help:
1) send us a test model for reproducing
2) is FK created by the Generate Database Script From Model wizard?

RobertK
Posts: 111
Joined: Thu 02 Mar 2017 05:44

Re: BUG? Association, Foreign key, Sync is broken? (Model --> Database)

Post by RobertK » Wed 12 Apr 2017 04:40

Shalex wrote:If your model is Devart Entity Model (*.edml), you should run Regenerate Storage and Mapping to create FK in SSDL basing on the new association in CSDL.
How do you regenerate storage and mapping?
Shalex wrote:2) is FK created by the Generate Database Script From Model wizard?
Yes the FK exist, it's just when you do an "Update database from model" it's not there! new relationship changes goes undetected.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: BUG? Association, Foreign key, Sync is broken? (Model --> Database)

Post by Shalex » Wed 12 Apr 2017 15:13

RobertK wrote:
Shalex wrote:If your model is Devart Entity Model (*.edml), you should run Regenerate Storage and Mapping to create FK in SSDL basing on the new association in CSDL.
How do you regenerate storage and mapping?
You should open your *.edml model, right click the diagram surface > Regenerate Storage and Mapping.
RobertK wrote:
Shalex wrote:2) is FK created by the Generate Database Script From Model wizard?
Yes the FK exist, it's just when you do an "Update database from model" it's not there! new relationship changes goes undetected.
Please send us a test model for reproducing the issue when FK is CREATED by the Generate Database Script From Model wizard and NOT created by the Update Database From Model wizard.

Post Reply