A uuid(7) default in a migration's dataTransform is generated at emit time, so every self-emit changes the migration's hash
What happened
A dataTransform in a migration inserts a row into a table whose id is @default(uuid(7)): sql.public.actor.insert([{ kind: 'system' }]). The default is applied when the migration is emitted, not when it runs. The generated id is written into ops.json as a literal, so every database gets the same id, and every self-emit (node migration.ts) writes a new id and changes the migration's hash.
Reproduction
Versions: @prisma/orm-postgres 8.0.0-rc.12, prisma 8.0.0-rc.17-dev.124.
this.dataTransform(contract, 'create the system actor', {
check: () => /* rowset query meaning "no system actor yet" */,
run: () => sql.public.actor.insert([{ kind: 'system' }]),
}),Run node migration.ts twice. ops.json holds a different literal uuid each time (for example 01a0ebe5-edc4-765c-9a77-ac725759e16e), and migration.json's hash changes with it.
What was expected
Either the insert renders the default so that it is evaluated when the migration runs, or contract emit/self-emit refuses a client-generated default inside a migration plan with a diagnostic. A migration whose content changes on every emit cannot be reviewed or reproduced, and it breaks migration status in the same way as the known updatedAt case.
Related
The same shape was seen with temporal.updatedAtString() in an intermediate contract: the emit time is written into ops.json.
Source: prisma/prisma