Skip to content
Playground(another site)

bynk.parse.migrate_item

Error A migrate step's body holds something other than field := value, let or drop field.

A migrate step carries a stored record from an older schema version to the agent's current shape, so its body is only a list of what happens to each field: field := value assigns a current field, let x = value binds a local for later lines, and drop field discards a stored field on purpose. A step is pure, so nothing else belongs in it. The commonest mistake is = where := is meant; a bare expression lands here too. The position is the first token of the line that is none of the three.

Example

type CartV1 = { owner: String, total: Int }
agent Cart {
key id: String
store ownerName: Cell[String]
store totalCents: Cell[Int]
migrate from 1 (old: CartV1) {
ownerName = old.owner // ✗ a step assigns with `:=`
totalCents := old.total * 100
}
on call cents() -> Effect[Int] { … }
}
agent Cart {
key id: String
store ownerName: Cell[String]
store totalCents: Cell[Int]
migrate from 1 (old: CartV1) {
ownerName := old.owner // ✓
totalCents := old.total * 100
}
on call cents() -> Effect[Int] { … }
}

In the Book

See also

  • Every code in its category, Parser, on the diagnostic index.
  • bynk explain bynk.parse.migrate_item shows the same from the installed toolchain, without a network.