ErrorsEntities, stores and migrations · rule
migration.backfill_can_fail
Computed backfill can fail.
Area 5, Entities, stores and migrations; not declinable; the next step is usually the agent's.
A title can be empty or longer than five characters, so its length can
break Rank's min or max, and nothing says what such a record's rank
would be:
migration { Todo.rank: { backfill: Rank(text.length(Todo.title)) }}
error The backfill for Todo.rank can fail
--> database/migrations/20261020T1401_add_rank/changes.jadpo:3:19
|3 | backfill: Rank(text.length(Todo.title)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can break `Rank`'s `min` and `max`
- reason
- A backfill gives every
Todorecord already stored a value, and a record whose value failed would have none, so nothing in a backfill may fail. - next
- Work the value out with operations that can't fail, such as
integer.minandinteger.maxto keep a number in its range (agent) - rule
- migration.
backfill_ can_ fail - help
- https://jadpo.
dev/docs/errors/migration. backfill_ can_ fail
Kept in its range with integer.min and integer.max, the construction
can't fail, and the backfill runs.
Markdown for agents: /docs/errors/migration.backfill_can_fail.md.Built from Jadpo main at aee2e8f.