TML-2853: regenerate demo migration chain (follow-up — missed #817's merge race)#829
Conversation
📝 WalkthroughWalkthroughThe ChangesMigration chain regeneration for user_type value-set representation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
size-limit report 📦
|
@prisma-next/extension-author-tools
@prisma-next/mongo-runtime
@prisma-next/family-mongo
@prisma-next/sql-runtime
@prisma-next/family-sql
@prisma-next/extension-arktype-json
@prisma-next/middleware-cache
@prisma-next/mongo
@prisma-next/extension-paradedb
@prisma-next/extension-pgvector
@prisma-next/extension-postgis
@prisma-next/postgres
@prisma-next/sql-orm-client
@prisma-next/sqlite
@prisma-next/extension-supabase
@prisma-next/target-mongo
@prisma-next/adapter-mongo
@prisma-next/driver-mongo
@prisma-next/contract
@prisma-next/utils
@prisma-next/config
@prisma-next/errors
@prisma-next/framework-components
@prisma-next/operations
@prisma-next/ts-render
@prisma-next/contract-authoring
@prisma-next/ids
@prisma-next/psl-parser
@prisma-next/psl-printer
@prisma-next/cli
@prisma-next/cli-telemetry
@prisma-next/emitter
@prisma-next/migration-tools
prisma-next
@prisma-next/vite-plugin-contract-emit
@prisma-next/mongo-codec
@prisma-next/mongo-contract
@prisma-next/mongo-value
@prisma-next/mongo-contract-psl
@prisma-next/mongo-contract-ts
@prisma-next/mongo-emitter
@prisma-next/mongo-schema-ir
@prisma-next/mongo-query-ast
@prisma-next/mongo-orm
@prisma-next/mongo-query-builder
@prisma-next/mongo-lowering
@prisma-next/mongo-wire
@prisma-next/sql-contract
@prisma-next/sql-errors
@prisma-next/sql-operations
@prisma-next/sql-schema-ir
@prisma-next/sql-contract-psl
@prisma-next/sql-contract-ts
@prisma-next/sql-contract-emitter
@prisma-next/sql-lane-query-builder
@prisma-next/sql-relational-core
@prisma-next/sql-builder
@prisma-next/target-postgres
@prisma-next/target-sqlite
@prisma-next/adapter-postgres
@prisma-next/adapter-sqlite
@prisma-next/driver-postgres
@prisma-next/driver-sqlite
commit: |
Replaces the single from-empty baseline (the prior attempt on this branch) with a multi-step incremental chain re-authored from the original 7-folder history, so the demo still exercises the migration CLI's apply-successive-migrations path (db update, migration status/list across a chain). What changed vs the original chain: - Initial migration (20260422T0720_initial): the hand-written `CREATE TYPE user_type AS ENUM` rawSql op is removed; `user.kind` is now a `text` column and a `user_kind_check` CHECK constraint enforces the value set from the start. - Deleted 20260611T1856_convert_user_type_to_value_set: nothing to convert now — user_type was never native. - Kept every other incremental milestone unchanged: displayName add (0742), displayName backfill + NOT NULL (0748), MTI variant link columns (mti_variant), post.priority value-set + check (add_priority_enum), priority default (set_priority_default). - All user_type enum blocks in the per-step contract.prisma snapshots use the bare-member form, matching the current src/prisma/contract.prisma. - Derived artifacts regenerated via scripts/regen-example-migrations.mjs. The chain is hash-continuous and its final to-hash equals the current contract storageHash; it applies cleanly empty→current. Tests re-pointed: - migration-replay.integration.test.ts: doc comment updated to describe the new chain (assertions already verify text + user_kind_check, no native enum). - migration-integrity.test.ts: added an explicit databaseOperation timeout to the positive aggregate-check test (cold import of the large contract.json exceeds the 100ms global default). Upgrade coverage: recorded an incidental-regeneration declaration in skills/upgrade/prisma-next-upgrade/upgrades/0.13-to-0.14/instructions.md (examples-only diff, no new consumer action beyond the existing enum-becomes-domain-concept entry). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…rride, #829) Revises spec component 4 to record the multi-step regeneration approach. The earlier single-migration framing (#817 review) was itself overruled on #829: the demo must keep a multi-step incremental chain to demonstrate the incremental migration CLI. Component 4 now describes re-authoring the original history in the value-set representation — initial migration creates user.kind as text + user_kind_check from the start, convert self-edge removed, all other incremental milestones preserved. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
4ba2d10 to
2970087
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
skills/upgrade/prisma-next-upgrade/upgrades/0.13-to-0.14/instructions.md (1)
298-298:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winRemove or update the example migration reference that is being deleted in this PR.
The upgrade guide at line 298 references
examples/prisma-next-demo/migrations/app/20260611T1856_convert_user_type_to_value_set/migration.tsas a worked example for users converting their own databases. However, the PR's TML-2853 block (lines 359–373) states that this migration (the "self-edge conversion migration") is being removed from the regenerated chain. The documentation will reference a path that no longer exists in the repository after this PR merges, violating the doc-maintenance guideline to keep links and references current.Fix: Either (1) remove the specific path reference at line 298 and replace it with a generic description of the conversion pattern (without relying on the demo example), or (2) retain the conversion migration in the demo for documentation purposes.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@skills/upgrade/prisma-next-upgrade/upgrades/0.13-to-0.14/instructions.md` at line 298, The upgrade guide at line 298 contains a specific reference to the example migration at `examples/prisma-next-demo/migrations/app/20260611T1856_convert_user_type_to_value_set/migration.ts`, but the TML-2853 block (lines 359–373) indicates this migration is being removed from the regenerated chain. Remove the specific file path reference and replace it with a generic description of the three-operation conversion pattern (data-class ALTER with USING, addCheckConstraint, and DROP TYPE) with pre/postchecks for idempotency, OR alternatively ensure the conversion migration is retained in the demo repo so the documented reference remains valid.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@skills/upgrade/prisma-next-upgrade/upgrades/0.13-to-0.14/instructions.md`:
- Around line 359-373: The example reference at line 298 in the
`enum-becomes-domain-concept` section points to the
`20260611T1856_convert_user_type_to_value_set` migration, which is being removed
during the migration chain regeneration described in the PR comment. Locate this
stale migration reference in the documentation and either remove it entirely or
replace it with a reference to a migration that will still exist after the chain
is regenerated (such as one of the preserved incremental milestones like
displayName, MTI variant link columns, or post.priority value-set migration).
---
Outside diff comments:
In `@skills/upgrade/prisma-next-upgrade/upgrades/0.13-to-0.14/instructions.md`:
- Line 298: The upgrade guide at line 298 contains a specific reference to the
example migration at
`examples/prisma-next-demo/migrations/app/20260611T1856_convert_user_type_to_value_set/migration.ts`,
but the TML-2853 block (lines 359–373) indicates this migration is being removed
from the regenerated chain. Remove the specific file path reference and replace
it with a generic description of the three-operation conversion pattern
(data-class ALTER with USING, addCheckConstraint, and DROP TYPE) with
pre/postchecks for idempotency, OR alternatively ensure the conversion migration
is retained in the demo repo so the documented reference remains valid.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: c457f0d9-d345-446a-b68b-485adedaa6ca
⛔ Files ignored due to path filters (1)
projects/enums-as-domain-concept/slices/cutover-delete-native-enums/spec.mdis excluded by!projects/**
📒 Files selected for processing (20)
examples/prisma-next-demo/migrations/app/20260422T0720_initial/contract.prismaexamples/prisma-next-demo/migrations/app/20260422T0720_initial/migration.jsonexamples/prisma-next-demo/migrations/app/20260422T0720_initial/migration.tsexamples/prisma-next-demo/migrations/app/20260422T0720_initial/ops.jsonexamples/prisma-next-demo/migrations/app/20260422T0742_migration/contract.prismaexamples/prisma-next-demo/migrations/app/20260422T0748_migration/contract.prismaexamples/prisma-next-demo/migrations/app/20260605T1145_mti_variant_link_columns/contract.prismaexamples/prisma-next-demo/migrations/app/20260610T0000_add_priority_enum/contract.prismaexamples/prisma-next-demo/migrations/app/20260610T2216_set_priority_default/contract.prismaexamples/prisma-next-demo/migrations/app/20260611T1856_convert_user_type_to_value_set/contract.prismaexamples/prisma-next-demo/migrations/app/20260611T1856_convert_user_type_to_value_set/end-contract.d.tsexamples/prisma-next-demo/migrations/app/20260611T1856_convert_user_type_to_value_set/end-contract.jsonexamples/prisma-next-demo/migrations/app/20260611T1856_convert_user_type_to_value_set/migration.jsonexamples/prisma-next-demo/migrations/app/20260611T1856_convert_user_type_to_value_set/migration.tsexamples/prisma-next-demo/migrations/app/20260611T1856_convert_user_type_to_value_set/ops.jsonexamples/prisma-next-demo/migrations/app/20260611T1856_convert_user_type_to_value_set/start-contract.d.tsexamples/prisma-next-demo/migrations/app/20260611T1856_convert_user_type_to_value_set/start-contract.jsonexamples/prisma-next-demo/test/migration-integrity.test.tsexamples/prisma-next-demo/test/migration-replay.integration.test.tsskills/upgrade/prisma-next-upgrade/upgrades/0.13-to-0.14/instructions.md
💤 Files with no reviewable changes (8)
- examples/prisma-next-demo/migrations/app/20260611T1856_convert_user_type_to_value_set/ops.json
- examples/prisma-next-demo/migrations/app/20260611T1856_convert_user_type_to_value_set/migration.ts
- examples/prisma-next-demo/migrations/app/20260611T1856_convert_user_type_to_value_set/start-contract.json
- examples/prisma-next-demo/migrations/app/20260611T1856_convert_user_type_to_value_set/end-contract.d.ts
- examples/prisma-next-demo/migrations/app/20260611T1856_convert_user_type_to_value_set/migration.json
- examples/prisma-next-demo/migrations/app/20260611T1856_convert_user_type_to_value_set/end-contract.json
- examples/prisma-next-demo/migrations/app/20260611T1856_convert_user_type_to_value_set/start-contract.d.ts
- examples/prisma-next-demo/migrations/app/20260611T1856_convert_user_type_to_value_set/contract.prisma
Linked issue
Refs TML-2853. Follow-up to #817.
Why this exists
#817 merged on a stale HEAD due to an auto-merge/merge-queue race: the migration-history regeneration commit was pushed but not yet ingested into the PR when the queue merged the prior commit. So the cutover landed, but the demo's migration chain on
mainstill carries the pre-cutover artifact it was meant to remove — an initial migration that runsCREATE TYPE "public"."user_type" AS ENUM (…)(a state the post-cutover system can no longer produce) plus aconvert_user_type_to_value_setself-edge migrating that impossible start-state to the value-set form.As discussed on the #817 review: a migration demonstrating a transition from a now-impossible system state is an incoherent teaching artifact. This PR lands the fix that missed the merge.
What it does
Deletes the entire
examples/prisma-next-demo/migrations/app/chain (all 7 folders, including the converting self-edge) and regenerates it from scratch via the standard regen flow into a single20260615T0000_initialthat authors the current value-set / domain-enum representation directly:user.kindistext NOT NULL+user_kind_checkCHECK — noCREATE TYPEanywhere.post.priorityistext DEFAULT 'low'+post_priority_check.migration-integrityandmigration-replaytests re-pointed at the regenerated chain (replay verified against a dev DB). Spec component 4 amended to record the operator's override of the earlier "history is OUT" pin.Chain shape (judgment call, flagging)
Collapsed to a single initial migration rather than a regenerated multi-step evolution chain — the integrity test's self-edge case injects its own synthetic migration, so it doesn't need a real multi-step chain, and a single baseline is the simplest honest shape. If a multi-migration evolution narrative (each step in the new representation) is preferred for the demo, say so and I'll regenerate as a chain.
Verification
pnpm build66/66 ·pnpm typecheck138/138 ·pnpm fixtures:checkclean ·pnpm --filter prisma-next-demo test57/57 (integrity offline + replay against dev DB)CREATE TYPE,convert_user_type,enum2,postgres-enum,pg/enum@1in committed demo migration ops.Checklist
TML-NNNN:form.Summary by CodeRabbit
Documentation
Refactor
Chores