CYPHER_SET_ACTIVE_BRANCH = '\nMATCH (
t:Thread {thread_id: $thread_id, checkpoint_ns: $checkpoint_ns})\nOPTIONAL MATCH (t)-[old:ACTIVE_BRANCH]->()\nDELETE old\nWITH t\nMATCH (t)-[:HAS_BRANCH]->(b:Branch {branch_id: $branch_id})\nCREATE (t)-[:ACTIVE_BRANCH]->(b
)\nRETURN b.branch_id as branch_id\n'