Forum:  Designer

Thread:  Refactoring DB Table Names


Marcus (User)   Posted on: 12-Nov-2005 11:20:14.
Frans,

What happens when I change a table name in the database and refresh the catalog?

I have some refactoring to do which includes changing some table names. I seem to remember that the designer simply removes the Entities mapped to the removed table from the list... Shocked and hence removes all my hard work in renaming and hiding the related fields etc...

Can you recommend a way to do this which has the least impact on the project file?

Can I hack the project file itself by simple directly changing the table / entity names and then do a refresh (remember DiskDoctor) ? Laugh

[edit] Could I use the ProjectInspector code to help make these changes?

Marcus
Otis (LLBLGen Pro Team)   Posted on: 12-Nov-2005 13:16:09.
Marcus wrote:
Frans,

What happens when I change a table name in the database and refresh the catalog?

I have some refactoring to do which includes changing some table names. I seem to remember that the designer simply removes the Entities mapped to the removed table from the list... Shocked and hence removes all my hard work in renaming and hiding the related fields etc...

I think it's good that you check out the new features added to the preferences in 1.0.2005.1 Regular Smiley Especially the settings which will show you a dialog in which you can select the targets for entities which targets are apparently not available (e.g. renamed Wink). LLBLGen Pro can find renamed tables btw, though if you don't want to rely on that, simply use that new feature. You should also take a look into the refresher preference which will sync names with target element names, like table/view names and field names automatically.

Quote:

Can you recommend a way to do this which has the least impact on the project file?

Well, for everything: switch on the backup creation preference for the refresher. That way, you always have a backup for the situation when things go wrong.

Quote:

Can I hack the project file itself by simple directly changing the table / entity names and then do a refresh (remember DiskDoctor) ? Laugh

[edit] Could I use the ProjectInspector code to help make these changes?
Marcus

The projectinspector shows you the objectmodel indeed, the point is though that your catalog should be migrated as well. It's in general easier to rely on the features offered by the designer to get the mappings migrated. With the new preference (it's called 'ManuallySelectRenamedTargetsAfterRefresh') it's even easier and you won't run into the risk that entities got removed because the refresher can't find the target Regular Smiley

You can also do your refactorings of the db in multiple steps:
- first rename the tables, refresh
- check the mappings in the entity overview listing (rightclick on 'Entities', select 'View entity list')
- if ok, proceed by removing/adding fields, fks etc. refresh.


Marcus (User)   Posted on: 12-Nov-2005 13:48:09.
Thanks I'll let you know how I get on... Regular Smiley
LukeO (User)   Posted on: 15-Oct-2008 21:18:37.
I'm trying to do the same but with a typed view. I want to rename four typed views and just want to to tweak the db names as referenced in LLBLGEN. The LLBLGEN names will stay the same as well as the other custom settings. I just want to change the view name.

Is it possible?

Thanks,
-Luke

Marcus wrote:
Thanks I'll let you know how I get on... Regular Smiley





Walaa (Support Team)   Posted on: 16-Oct-2008 12:29:07.
Curently you'll have to re-add the TypedViews after renaming the database views and doing a catalog refresh.
Then if you want to keep the old TypedView names, you'll have to rename them back.

P.S. Next time please open a new thread.
LukeO (User)   Posted on: 16-Oct-2008 17:50:47.
Thanks. I will do that.

There is probably a fine line between adding to an existing thread (which I thought was related) and making a new thread. I tried to do my due dilgence and search all existing forums for an answer to my question before posing another one.

-Luke



Walaa wrote:
Curently you'll have to re-add the TypedViews after renaming the database views and doing a catalog refresh.
Then if you want to keep the old TypedView names, you'll have to rename them back.

P.S. Next time please open a new thread.