UserOfficeProject / issue-tracker

Shared place for features and bugs from all collaborators.
0 stars 0 forks source link

Remove the Postgres function REPLACE_OLD_USER_ID_WITH_NEW #1155

Open yoganandaness opened 2 months ago

yoganandaness commented 2 months ago

The PR https://github.com/UserOfficeProject/user-office-core/pull/508 contains the migration which is more STFC specific and it creates an additional table MERGING_TABLE_REGISTRY and function REPLACE_OLD_USER_ID_WITH_NEW. These will not be completely useful for other facilities including ESS. If this is completely STFC specific, i think it is a better idea to have it created in private, so that it does not get created for other facilities.

If this make sense, i would recommend dropping this in a new migration.

Steps to reproduce (if it's a bug).

yoganandaness commented 2 months ago

@bashanlam Reach out to me in case of any concerns.

bashanlam commented 1 month ago

@bashanlam Reach out to me in case of any concerns.

@yoganandaness REPLACE_OLD_USER_ID_WITH_NEW is not an STFC-specific function; it is designed to update user_id values in tables throughout the schema.

The process involves identifying columns in tables with a foreign key constraint on the USER_ID field of the USERS table and storing them in the MERGING_TABLE_REGISTRY. Each column is then checked for its inclusion in primary or unique key constraints, and the fields are updated accordingly.

yoganandaness commented 1 month ago

@bashanlam Thanks for detailed explanation of the process. I think i would know about this better if i understand the Merge User Tool(https://github.com/isisbusapps/merge-user-tool/issues/227) for which i dont have the access.

I can see that you have deleted the user and replaced with a new one with all empty details. I am still trying to forecast, if this will be a requirement for us at all.

But let me also have a word with @bolmsten and we can discuss about this, when we meet.

bashanlam commented 1 month ago

@yoganandaness Attached is https://github.com/isisbusapps/merge-user-tool/issues/227 for you reference. Issue_227.pdf