My company has a situation where they need to rename thousands of folders in a vault.
In a test server - I have partial success already through stopping services, SQL statement, and clearing the local cache of the structure
In SQL I opened the vault database --> went to the PROJECTS table
Then essentially renamed both the corresponding PROJECTS and PATH contents
BEFORE:
NAME: Customer123
PATH: \Customer123\
AFTER:
NAME: 123Customer
PATH: \123Customer\
All associated paths and files look perfect and open without error.
However I get this error when trying to add new files to the environment.
"SolidWorks PDM: Could not add documents!
Cause: You don't have permissions to perform this action"
That looks like a possible option but doesn't really provide a working example. I am not familiar with linking to their API.
A quick Google search didn't turn up any working examples either.
Do you have any suggestion on the permission error as well?
You should never modify anything directly in the database. Doing this in the database can break file references. I hope you have a backup of your database before the changes.
The backbone of PDM is a SQL Relational Database, meaning tables have relations to other tables. You manually change one table but not related tables screws up the entire database.
When you go into the Admin tool and look at either group or user permissions per folder, do the newly named folders show?
If not, then most likely you would have to change those paths within the database also. And then it might lead to another area you will have to change. Without a schema of the DB, it is hard to say precisely what needs to change throughout the entire DB to change the folder paths.
I agree that the API would be a better option, but does suck that there is no example. This would be where I would get my VAR involved as they may already have something like this or could help develop something for you.
I bet you ask for help at the hardware store, too...Kidding aside, this is the best advice I've seen in this thread. This type of change probably happens pretty frequently...So much so that this type of thing in Pack and Go is pretty darn easy.
Matt, everyone needs to ask for help sometimes, even at the hardware store (assuming you can find someone to ask)...
Having worked for a VAR for many years I saw the aftermath of users trying to modify the DB themselves and spending my time repairing said DB.
I am going to look into my archives of programs and see if I have one that will work for him or at least provide a good example and then will post (most likely tomorrow sometime).
It was a joke Jeff...my sarcasm doesn't come off as well as I'd like over the interwebs...
I completely agree, manually editing a DB will screw you up in ways you cannot imagine, and it may pop up as a problem many hours, days, weeks, or even months later.
Jeff,
I hope you can find an example to post, but the devil's in the details. As you're probably aware renaming the folder itself is easy
Things the programmer must consider are that no files can be checked out in the folder. Also, doing this in batch requires some knowledge about the specifications, i.e. based on the example above, take last 3 digits (is it always 3?) and move to the start of the name. Search for any folders that meet the spec or read from a list in file?
That said, I'm sure everyone appreciates your willingness to help.
We miss you buddy!!
I agree with all the supplied answers. Yes we would never do this without proper Server\DB backups. I understand SQL very well which is why I chose that method over the C#/C++ methods.
My VAR advised against it as well but I thought I would give it a shot.
Like I stated I changed it in a test environment and it worked perfectly for everything excluding placing a new file.
If I had the permission segment of the change I could supply you a new way of completing some mass tasks very easily.
A data dictionary or the DB Schema would be awesome but I haven't found that as well.
Do not mess with the vault's db directly. You will lose your warranty if you make any direct writes.
You can do this via the API. I would personally question why you need to this in the first place. This is definitely an XY problem.
Things to be mindful of when you are writing such program:
- Consider studying how your references cross folders. This is very important. Are some of your folders independent compartment in terms of references? If so, use the small folder as a test case first.
- Make sure all files are checked in while you do this.
- This has the eminent potential of messing your references.
If this is a business critical task, I suggest you hire a programmer to do this.
Best,
Amen
SOLIDWORKS PDM API Programming services
All good points, and get your VAR involved. Because if things get screwed up the VAR has a direct line to DS and if they're part of whatever you're doing they also own it in part.
Paul, (and anyone else reading this thinking of doing the same thing)
There are just too many areas where a change takes place in the vault database. For instance, for every folder name change, there exists a record in HistoryRename table. Which stores the name changes of not only folders but files too. By editing the table manually you will swiss-cheese the vault database with holes of data missing. and I'm not even getting into the OnUpdateProjectTrigger or other triggers yet!
I would pay close attention to the advice of other folks here saying to not update your database manually. if you must proceed, use API - or contact your reseller as they may have already a tool they can sell you.
Francisco Guzman | CSWS-DMA
GoEngineer