To transfer an enrolment from an old user to a new one, you must manually run a Cypher statement.
-
Ask the user to log in with their new account and let you know the authentication method (Google account, email & password etc.)
-
Run the following Cypher statement:
:params { old: "[email protected]", new: "[email protected]"}
MATCH (new:User {email: $new})
MATCH (old:User {email: $old})-[r:HAS_ENROLMENT]->(e)
DELETE r
MERGE (new)-[:HAS_ENROLMENT]->(e)
SET new.id = coalesce(new.id, randomUuid())
Or, if you have the ID of the accounts from the user’s public profile, you can use those instead:
:params { old: "xxxxxxxx-000x-xx00-x000-x0000x00000", new: "xxxxxxxx-000x-xx00-x000-x0000x00001"}
MATCH (new:User {id: $new})
MATCH (old:User {id: $old})-[r:HAS_ENROLMENT]->(e)
DELETE r
MERGE (new)-[:HAS_ENROLMENT]->(e)
Or, in the website
repository, you can run the following command to transfer from the user node with the id
property of the fourth argument to the one with the id
property of the fifth.
The third parameter can be id
or email
.
npm run cmd:transfer-enrolments id xxxxxxxx-000x-xx00-x000-x0000x00000 xxxxxxxx-000x-xx00-x000-x0000x00001