If you change the project name and copy the sandstar definitions to sandstar. Haystack refs will be broken this function helps us to fix the haystack refs easily.


How to use?

  • Copy axon function
  • Make the call reChangeProj() in Tools.


reChangeProj()
() => do
  curProjName: context()["projName"]
  channels: readAll(channel and (haystackCur or haystackWrite))
  newRecs: []
//  changes: []
  
  channels.each(c => do
    targetTags: {}
    newVals: {}
    
    if (c.has("haystackCur")) targetTags = targetTags.set("haystackCur", c["haystackCur"])
    if (c.has("haystackWrite")) targetTags = targetTags.set("haystackWrite", c["haystackWrite"])

    targetTags.each((val, tag) => do
      newVal: val.split(":")
      newVal = newVal.set(1, curProjName)
      newVal = newVal.concat(":")
      newVals = newVals.set(tag, newVal)
    end)
/*    
    newVals = newVals.set("id", c["id"])
    changes = changes.add(newVals)
*/    
    newRecs = newRecs.add(c.diff(newVals).commit())
  end)
  
  return newRecs
end

  • No labels