Skip to content
This repository was archived by the owner on Aug 25, 2026. It is now read-only.

Commit 4a5d152

Browse files
sorenbsclaude
andcommitted
Add migrations-showcase example and fix false literal defaults
Two changes that together produce a rich, replayable 20-migration history for migration-aware tooling: - Fix contract canonicalization dropping literal false / empty-array column default values. isDefaultValue() treats false and [] as omittable shape defaults, but a default literal payload is data — dropping it produced a contract.json that failed its own structural validation on the next read (surfaced as PN-CLI-4003 when planning a migration for a `Boolean @default(false)` column). - Add examples/migrations-showcase: 20 cumulative schema snapshots of a project tracker (models, enums, relations, indexes, uniques, plus a destructive column drop and a retired model) and a generate script that runs the real emit → migration plan → migrate flow per step against a Postgres database, then captures prisma_contract.marker and prisma_contract.ledger (including contract_json_before/after) into fixture/prisma-contract.json for downstream demos. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Søren Bramer Schmidt <sorenbs@gmail.com>
1 parent e1508fb commit 4a5d152

173 files changed

Lines changed: 123204 additions & 20 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# migrations-showcase
2+
3+
Generates a realistic 20-migration history with the real Prisma Next migration flow, for demoing migration-aware tooling (e.g. the Prisma Studio Migrations view).
4+
5+
`steps/` holds 20 cumulative snapshots of a project-tracker schema — models, fields, enums, relations, indexes and uniques are added over time, and a few steps are deliberately destructive (a dropped column, a retired model) so downstream diffs exercise every change kind.
6+
7+
## Run it
8+
9+
```bash
10+
pnpm --filter migrations-showcase generate
11+
```
12+
13+
For each step the script emits the contract, plans an attested migration bundle into `migrations/app/`, and applies it to an ephemeral Prisma Postgres dev database. Every apply writes one `prisma_contract.ledger` row carrying the migration's `contract_json_before` / `contract_json_after` snapshots.
14+
15+
After the last step the script captures `prisma_contract.marker` and `prisma_contract.ledger` into `fixture/prisma-contract.json`, ready to be replayed by demo seeds.

0 commit comments

Comments
 (0)