New Posts New Posts RSS Feed: changing the names of the tables
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

changing the names of the tables

 Post Reply Post Reply
Author
Linguinut View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Jun-2007
Location: United States
Posts: 394
Post Options Post Options   Quote Linguinut Quote  Post ReplyReply Direct Link To This Post Topic: changing the names of the tables
    Posted: 06-Nov-2007 at 9:07am
You know, it would be rather nice to be able to just change the name of the source table within the utility.  A little remapper popup to make the job easier...just point the class to the renamed table and all would be well.  I think the reasoning that this doesn't exist in DevForce is that database table naming rarely changes once created, so the feature would receive a low priority rating.
Back to Top
Dominique View Drop Down
Groupie
Groupie
Avatar

Joined: 28-Jun-2007
Location: Norway
Posts: 44
Post Options Post Options   Quote Dominique Quote  Post ReplyReply Direct Link To This Post Posted: 04-Nov-2007 at 11:44pm
Hi Bill,
Thank you for your reply. I guess I will do it that way :-)

It would be nice to have the possibility to rename the table from inside the mapper which could take care of all the relations. I guess it is possible to do that right into the ".orm" file.
But my new chrismas wish would be a rename function with the following use case :-)
1> open mapper
2> Choose "Do not validate mapping, allow all edits
3> Choose "rename tables" (maybe with a possibility to choose from the db schema)
4> Mapper has updated the mapping inclusive the defined relations :-)

Dominique

Edited by Dominique - 04-Nov-2007 at 11:44pm
Dominique
Back to Top
Linguinut View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Jun-2007
Location: United States
Posts: 394
Post Options Post Options   Quote Linguinut Quote  Post ReplyReply Direct Link To This Post Posted: 02-Nov-2007 at 9:30am
Here is where the ORM is a real gem! 
 
The key idea is to keep your class name the same
 
After the name of the table is changed in the DB, open the ORM mapper and allow it to update the objects/schema (first option).  You'll be notified that there is a change.  Jot down the class name that will have a new database table name (e.g. "User").  Remove the offending class.  This may not feel like the right thing to do, but at this point no changes have been made yet to your model project.  All is well.  Next, add the new table from the datasource.  Rename the class which will default to the new table name (e.g. "aa_User") to the original class name (e.g. "User").  Save the mapper's changes and the model project will be updated with the database table name change. 
 
The best thing is that ALL of your code that references that business class will be unaffected.  Only you and the DBA will have to know that anything even happened.
 
Hope that helps,
Bill
Back to Top
Dominique View Drop Down
Groupie
Groupie
Avatar

Joined: 28-Jun-2007
Location: Norway
Posts: 44
Post Options Post Options   Quote Dominique Quote  Post ReplyReply Direct Link To This Post Posted: 02-Nov-2007 at 7:14am
Hi,
I will need to change the names of the tables in the db (ex from User to aa_User)and I can't find directives for how I could update the mapping to reflect these changes. Could you give me a pointer to ressource explaining how to do that?
thanks :-)
Dominique
Dominique
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down