ErrorsEntities, stores and migrations · rule
migration.decision_required
A migration needs your decision, such as a value for records already stored, and its changes.jadpo doesn't give one yet.
Area 5, Entities, stores and migrations; not declinable; the next step is usually the human's.
Why Jadpo refuses it
Here Note gains a required field, stars, and the database already
holds notes with no stars. A required column can't be added while rows
in it have no value, so the migration can't run until something says
what those notes get.
Jadpo won't make up the value, because it becomes real data on every
existing note. jadpo migrate new writes the migration with a line to
fill in, and jadpo check fails until it is filled.
What it looks like
Note had only an id when the first migration was written. Then
stars was added, and jadpo migrate new add_stars wrote a migration
whose decision is still empty:
database/migrations/20261020T1401_add_stars/changes.jadpo:
migration { Note.stars: {}}
error Migration 20261020T1401_add_stars needs a decision about Note.stars
--> database/migrations/20261020T1401_add_stars/changes.jadpo:2:5
|2 | Note.stars: {} | ^^^^^^^^^^ decide here
- reason
Note.starsis required, and theNoterecords already stored have no value for it.- next
- Set
backfill:forNote.stars, such asbackfill: 1, then runjadpo migrate newto finish the migration (human) - rule
- migration.
decision_ required - help
- https://jadpo.
dev/docs/errors/migration. decision_ required
(human) at the end of the next: line tells your coding agent to stop
and ask you which fix you want, because the choice is yours to make: it
decides how many stars every note already stored gets.
How to fix it
The question is what value the notes already stored should have.
If every existing note should get the same value, write it as the
field's backfill:. changes.jadpo becomes:
migration { Note.stars: { backfill: 1 }}
Then run jadpo migrate new with no purpose, which finishes the
migration that is waiting for its decision:
jadpo migrate newfinished 20261020T1401_add_stars, which migrates from 20261020T1400_initial Note + stars smallint new fieldWrote database/migrations/20261020T1401_add_stars/ snapshot.json the whole schema at this point postgres.sql 3 statements: add column, fill existing rows, require a value changes.jadpo every decision madenext: jadpo check confirms the migration matches the entities
When the migration is applied, it adds the column, sets every existing
note's stars to 1, and then makes the column required.
A value can also be worked out from each note's own fields, when the new field reshapes data the note already holds (Computed backfills).
Related
Markdown for agents: /docs/errors/migration.decision_required.md.Built from Jadpo main at aee2e8f.