Change the Owner of a Repository in the Administration Database
Symptom
You want to delete a Login in the User-Management section and get the following error message:
Requested URL: /Admin/rest/UserManagement/Users/Delete/3
---- Stack Trace --------------
org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [DELETE FROM [AdmUsers] WHERE [UserId]=?]; The DELETE statement conflicted with the REFERENCE constraint "AdmRepoOwner". The conflict occurred in database "igxAdmin", table "dbo.AdmRepositories", column 'Owner'.; nested exception is java.sql.SQLException: The DELETE statement conflicted with the REFERENCE constraint "AdmRepoOwner". The conflict occurred in database "igxAdmin", table "dbo.AdmRepositories", column 'Owner'.
Problem
The user to be deleted is registered as the owner of one of the repositories, that are registered in the Administrative Database
Step-by-step guide
- In the Microsoft SQL Management Studio, you have to navigate to the Administrative DB
- Right Mouse Button and select the Command "New Query"
- Paste the following commands into the Query window and execute them
SELECT TOP 1000 [RepositoryId]
,[RepositoryName]
,[RepositoryShortname]
,[Owner]
,[UserName]
FROM [AdmRepositories] JOIN [AdmUsers] ON [Owner]=[UserId] In the result table you'll find all Owner IDs. (In the iGrafx Platform --> User Management --> User: If you click on a user name there, you will find the corresponding Owner ID in the browser's Adress bar)
e.g.: http://de.igrafxdemo.com:8080/Admin/UserManagement/Users/Edit/2023 <-- 2023 is the Owner IDNow you need to know the Owner ID of the user, that should get the ownership. Then execute the following in the Query window:
UPDATE [AdmRepositories] SET [Owner]=? WHERE [Owner]=?
Hint: The question marks have to be substituted by the corresponding Owner IDs...