Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/prisma/prisma-next/llms.txt

Use this file to discover all available pages before exploring further.

prisma-next migration show renders the full details of a single migration package: its planned operations with operation-class badges, a DDL preview of the changes, metadata such as the migrationHash, and a prominently highlighted warning when the migration contains destructive operations. It is a read-only inspection command and never modifies any files.

Options

target
string
Which migration to inspect. Accepts:
  • A directory path (any string containing / or \) — reads that directory directly.
  • A migrationHash prefix (git-style matching) — scans all attested migrations and returns the one whose hash starts with the given prefix.
  • Omitted — defaults to the latest migration in the graph.
--config
string
Path to prisma-next.config.ts. Defaults to ./prisma-next.config.ts in the current working directory.
--json
boolean
Emit a machine-readable JSON envelope instead of the default TTY output.
-q
boolean
Quiet mode — suppresses all output except errors.
-v
boolean
Verbose output — includes additional metadata and timings.

Target resolution

migration show resolves the target argument in the following order:
  1. Path — if the argument contains a / or \, it is treated as a directory path and that package is read directly.
  2. Hash prefix — otherwise the argument is matched as a prefix against the migrationHash field of every attested migration. Matching follows the same git-style prefix semantics: the prefix must be long enough to be unambiguous; if more than one migration matches, the command exits with an error.
  3. Default (no argument) — the latest migration in the graph (the migration whose end-contract hash matches no other migration’s start-contract hash) is used.
prisma-next migration show

What it displays

Operations with class badges

Each operation is listed with a badge indicating its class:
BadgeClassMeaning
[additive]additiveCreates new schema elements; safe to apply to any database.
[widening]wideningExpands an existing constraint or type; generally safe.
[destructive]destructiveDrops or modifies schema elements in a way that may lose data.

DDL preview

For SQL targets, each operation includes a DDL preview showing the exact SQL statement that will be executed. This lets you review the migration’s effect before applying it.

Destructive warnings

When a migration contains one or more destructive operations, the output includes a prominent warning banner:
⚠ This migration contains destructive operation(s)
  Applying it may result in permanent data loss.
  Review the operations below before running migration apply.
Destructive operations such as DROP TABLE, DROP COLUMN, or ALTER COLUMN TYPE cannot be rolled back once applied. Always review migrations containing destructive operations before applying them to a production database.

Example output

TTY:
prisma-next migration show ➜ Inspect a migration package
  dir:            migrations/20240120-backfill-roles
  migrationHash:  sha256:ccc3abc...
  from:           sha256:bbb2...
  to:             sha256:ccc3...

Operations (3)

  ├─ [additive]    Create table user_roles
  │     CREATE TABLE user_roles (
  │       id   SERIAL PRIMARY KEY,
  │       name TEXT NOT NULL
  │     );

  ├─ [additive]    Add column role_id on users
  │     ALTER TABLE users ADD COLUMN role_id INTEGER;

  └─ [destructive] Drop column legacy_role on users
        ALTER TABLE users DROP COLUMN legacy_role;

⚠ This migration contains 1 destructive operation(s)
  Review carefully before applying to production.

JSON output format

{
  "ok": true,
  "migration": {
    "dir": "migrations/20240120-backfill-roles",
    "migrationHash": "sha256:ccc3abc...",
    "from": "sha256:bbb2...",
    "to": "sha256:ccc3...",
    "operations": [
      {
        "id": "table.user_roles",
        "label": "Create table user_roles",
        "operationClass": "additive",
        "ddl": "CREATE TABLE user_roles (id SERIAL PRIMARY KEY, name TEXT NOT NULL);"
      },
      {
        "id": "column.users.role_id",
        "label": "Add column role_id on users",
        "operationClass": "additive",
        "ddl": "ALTER TABLE users ADD COLUMN role_id INTEGER;"
      },
      {
        "id": "column.users.legacy_role",
        "label": "Drop column legacy_role on users",
        "operationClass": "destructive",
        "ddl": "ALTER TABLE users DROP COLUMN legacy_role;"
      }
    ],
    "hasDestructive": true
  },
  "timings": { "total": 14 }
}

Build docs developers (and LLMs) love