Is it possible for me to rename a table and maintain all the manual relationship associated to it on refresh?

Posts   
 
    
gemfore
User
Posts: 35
Joined: 30-Jul-2010
# Posted on: 22-Dec-2010 17:52:14   

Lets say for example i have a table named company and i want to then rename the table to companyData for example.

At the moment i'm going into sql - running sp_RENAME and then going back into the llblgen project and refreshing the project against the db. However when i do this i loose all the manual properties / relations i've set.

What the best alternative way to do this please which wont let me loose properties such as these

Thanks

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 22-Dec-2010 18:23:12   

Which version (release date) of the designer are you using?

gemfore
User
Posts: 35
Joined: 30-Jul-2010
# Posted on: 22-Dec-2010 22:32:59   

Its version 3 and the date is Novemver 15th

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 23-Dec-2010 05:48:36   

I think you should se the RelationshipsFollowDBForeignKeyConstraints Project's properties to false:

RelationshipsFollowDBForeignKeyConstraints When set to true (Default), all relationships have to have a foreign key constraint in the new relational model data after refresh, or they'll be removed. When set to true, new relationships are created from newly found foreign key constraints. When set to false, relationships without a foreign key constraint in the new relational model data are left as-is and there aren't any new relationships created from foreign key constraints found in the new relational model data. The value Default means the value in the preferences is used.

Also ensure that the RemoveUnmappedElementsAfterRefresh LLBLGen's preference is set to false:

RemoveUnmappedElementsAfterRefresh When set to true, any element which doesn't have a mapping after a catalog refresh is removed from the project. Default is false. The value Default means the value in the preferences is used.

David Elizondo | LLBLGen Support Team
gemfore
User
Posts: 35
Joined: 30-Jul-2010
# Posted on: 23-Dec-2010 10:28:46   

Thanks but the only thing is I've set that already the problem is as i'm renaming the table in MS SQL direct, the llblgen project is seeing them as new table when i refresh the schema.

Sorry if i'm missing something obvious here but could you give me a stepped guide on how i rectify this?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 23-Dec-2010 10:45:44   

Which LLBLGen Pro Designer version (release date) are you using?

Did you set the following properties to true? - SyncMappedElementNamesAfterRefresh - SyncRenamedMappedElementNamesAfterRefresh

gemfore
User
Posts: 35
Joined: 30-Jul-2010
# Posted on: 23-Dec-2010 11:15:46   

I have but i'm still getting ....

Entity 'mytable' is no longer mapped to a target as target table 'dbo.mytable' was not found in the catalog.

Which makes sense as theres no way for llblgen to know that i've renamed it.

So let me walk through what i did...

1) Have an existing project with 100+ tables and numerious manual relations 2) Gone into MS SQL managment studio and renamed all my tables 3) I've then Opened my llblgen project (Build Nov 15th - Version 3) and right clicked on the SQL server node under "Relationsal Modal Data", and clicked "Refresh Relational Model Data from a Database" , entered the connection setting, clicked next 4) First thihng i notice is all my renamed tables are no longer checked in the "elements to retreive" 5) Click next 6) And then my problem is like above i.e. all my renamed table are lost and all the manual properties / relations lost

Hope this makes sense?

gemfore
User
Posts: 35
Joined: 30-Jul-2010
# Posted on: 23-Dec-2010 11:20:13   

but if it help let me rephrase the question i'm trying to solve.

"How do i rename tables in SQL while still maintaining the properties and settings in llblgen"

I've can i rename them in llblgen and then update the sql db?

This really is quite a big problem/concern for me so any help would be greatly appreciated

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 23-Dec-2010 11:31:35   

Go to catalog explorer, select table, hit F2, rename table.

After you're done, click Validate and adjust relational model data. Then export Update DDL SQL script to rename the tables in the database. that's all. Don't use rename on the db directly, as llblgen pro then likely will think the table is dropped and some other table is created. However, it tries to find the table if you rename it, so it's not always the case you lose mappings, but the easiest is to simply rename the table in the catalog explorer. simple_smile

Frans Bouma | Lead developer LLBLGen Pro
gemfore
User
Posts: 35
Joined: 30-Jul-2010
# Posted on: 23-Dec-2010 11:48:54   

Many thanks