How to update 'repositories' table when changing location of repository?

Added by Sergiy Tkachuk over 6 years ago

Hello,

I have moved my repository to another server and url has been changed.
And I would like to update table 'repositories'.
It is clear what to do with 'url' column, but I can can't not realize how to update 'root_url'.

How to update 'root_url'?

(I tried to add repositories via repository Setting/Repositories on two different configuration it seems that I have not understood how many folder levels should be stripped out from 'repositories'.'root_url' in db. missed something?)

If there are other ways to update repositories table, it would be interesting for me to know.

I don't know Ruby language and it is not easy for me to trace source code to realize meaning of root_url.
Redmine version is 1.1.1.

Thanks in advance,
Sergiy

Replies (7)

RE: How to update 'repositories' table when changing location of repository? - Added by Toshi MARUYAMA over 6 years ago

There is no way to update 'url' and 'root_url' on Redmine forms.
Git and Mercurial revision hash value is unique, but Subversion and CVS revision number is not unique.
It is only way to modify database directly.

RE: How to update 'repositories' table when changing location of repository? - Added by Sergiy Tkachuk over 6 years ago

Yes, I know that there is no redmine forms.
But I am speaking about DB update directly.

I have SVN repository.

(And if I were having Git repository there is no issues - I don't clone repositories, I move files physically.
Can not say about Mercurial, because I am not familiar with it).

RE: How to update 'repositories' table when changing location of repository? - Added by Toshi MARUYAMA over 6 years ago

Sergiy Tkachuk wrote:

Yes, I know that there is no redmine forms.
But I am speaking about DB update directly.

SQL

update repositories set root_url = 'root_url', url = 'url' where id = id1

RE: How to update 'repositories' table when changing location of repository? - Added by Sergiy Tkachuk over 6 years ago

Sorry, but I completely don't understand your sql query.

What is id1?

are 'root_url' 'url' are string constants? not urls related to repository? what do you mean?

RE: How to update 'repositories' table when changing location of repository? - Added by Toshi MARUYAMA over 6 years ago

You can view and edit Redmine database with SQL, mysqladmin(MySQL), etc.

RE: How to update 'repositories' table when changing location of repository? - Added by Sergiy Tkachuk over 6 years ago

what is id1? there is no column id1 in repository table.

id1 is example.

RE: How to update 'repositories' table when changing location of repository? - Added by Blagoy Chepelov over 4 years ago

Hey Guys,

I know that this seems as a dull task and infact is :)

So creating an update sql statement is not an easy task and you could easily mess something up.

My 2 cents here:
1.Dump the table mysqldump -p --host=[yourserversip] -u [redmineuser] [nameofthedatabase] repositories > repositories_orig.sql
2.Copy the repositories_orig.sql to repository_new.sql then open it up with vi and replace your old address with the new one.
Example: https://10.10.10.2/svn/myproject should be changed to https://192.168.0.2/svn/myproject in vim write :%s/10.10.10.2/192.168.0.2/g
3.mysql -p --host=[yourserversip] -u [redmineuser] [nameofthedatabase] < repositories_new.sq

I hope this is going to be helpful to smb who ends up in this thread.

Cheers

(1-7/7)