Sync Entity project to DB

Posts   
 
    
teixbr
User
Posts: 4
Joined: 06-Dec-2022
# Posted on: 06-Dec-2022 15:32:43   

Hi there, I'm a newbie and have just recently bought a license to use the program.

I'm experiencing some issues, probably because I'm still getting to know the program. I've googled and searched the forum but couldn't find anything. Anyways, here it comes:

I'm using the 5.9.2 version built on August 29th.

I'm trying to sync a MSSQL Server 2019 DB (already created) to the LLBL program. I have been able to reverse engineer it. Now I want to play with it (modifying it adding new fields, deleting others, creating tables, etc) but I'm struggling to find a way to persist this changes back to the DB. It's easier when I add things, but when I delete them, I just can't find a way for it to delete the fields or whatever I did on the DB as well! I have tried every possible combination on with the "Sync Relational Model Data" tool. Only once was I able to see one field that I had deleted, to be deleted on the DB. I then went on to repeat the process and it didn't do it. Am I missing something? What would be the correct step-by-step guide to, for example, create a new field on the entity-> persist it to the DB -> then delete it on the entity -> persist on the DB?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39636
Joined: 17-Aug-2003
# Posted on: 06-Dec-2022 16:21:11   

If you reverse engineer the model from the relational model data, the source of truth is the relational model , so when you then delete a field in the entity, it'll simply delete the entity from the entity, the unmapped target field will be simply unmapped. You have to switch the Sync Source for the model in the Sync tab to 'model' or 'mixed'. Once you do that, and then delete a field from the entity and sync the relational model, it'll mark the field in the table for deletion. You then have to export a DDL SQL script to export the DDL SQL to delete the field from the database.

https://www.llblgen.com/Documentation/5.9/Designer/Functionality%20Reference/SyncTaskAspects.htm

Frans Bouma | Lead developer LLBLGen Pro
teixbr
User
Posts: 4
Joined: 06-Dec-2022
# Posted on: 06-Dec-2022 16:24:36   

Hi Otis. I have tried this, but it will just do nothing. That's the problem.

Just did this -> Added a field on the entity -> Synced with Mixed mode -> Column was saved on the DB -> Deleted the field on the entity -> Synced with mixed strategy -> nothing happened

teixbr
User
Posts: 4
Joined: 06-Dec-2022
# Posted on: 06-Dec-2022 16:49:40   

Also, I'm working with different schemas.

If I make a change (deleting a field on an entity) and specify to do a mixed sync on the schema which the entity belongs, it ends up deleting the whole schema from my entities

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39636
Joined: 17-Aug-2003
# Posted on: 06-Dec-2022 16:56:18   

You have to adjust the setting for orphaned elements: https://www.llblgen.com/Documentation/5.9/Designer/Functionality%20Reference/SyncTaskAspects.htm#cleaning-up-orphaned-relational-elements You likely now have a warning that a field is unmapped. You can set a setting to auto-clean these.

Additionally: the sync with the model adjusts the relational model data in the project. To make the changes have effect on your actual database you have to export DDL SQL scripts.

Frans Bouma | Lead developer LLBLGen Pro
teixbr
User
Posts: 4
Joined: 06-Dec-2022
# Posted on: 06-Dec-2022 17:01:17   

I have that set as "MarkForDeletion" which is what I'd want, but as I mentioned earlier, nothing is happening.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39636
Joined: 17-Aug-2003
# Posted on: 06-Dec-2022 17:25:53   

I can't reproduce it, works fine here. You might have set something differently. Please attach a repro case project and precise steps what you're doing so we can try to reproduce it. As this is a public forum, you can attach a new project that produces the problem, or open a new thread in the Helpdesk forum and refer to this thread so only we can see your project file.

Frans Bouma | Lead developer LLBLGen Pro