Skip to content

A peer-to-peer stack for code collaboration

603 B
Raw Blame
(load! (find-module-file! "monadic/names.rad"))

(import prelude/chain :unqualified)

;; This is a script that migrates the names chain. It is used when there is a
;; breaking change.

;; Example:
;; (migrate-names! "machines.radicle.xyz/chains/names"
;;                 "staging.machines.radicle.xyz/chains/names")

(def input-pat
  (list (/member ['add-name]) _ _))

(def input?
  (fn [i]
    (match i
           input-pat #t
           _         #f)))

(def migrate-names!
  (fn [old new]
    (def is (nth 1 (receive! old :nothing)))
    (create-name-chain! new)
    (send! new (filter input? is))))