Skip to content

migrate:create rename prompt doesn’t indicate up vs down diff (confusing; easy to choose wrong) #15106

@reeucq

Description

@reeucq

Describe the Bug

When running payload migrate:create, the rename prompt doesn’t say whether it’s for the up migration or the down migration. This is confusing because the prompt shows “create
table” for the old table name, which looks wrong if you’re thinking in the forward direction. It’s easy to pick the wrong option and end up with a down migration that
recreates an empty table (data loss on rollback).

  Is posts_blocks_hero table created or renamed from another table?
  ❯ + posts_blocks_hero                             create table
    ~ posts_blocks_post_hero › posts_blocks_hero    rename table
    ~ _posts_v_blocks_post_hero › posts_blocks_hero rename table
    ~ popular_posts › posts_blocks_hero             rename table
    ~ popular_posts_rels › posts_blocks_hero        rename table

Additional context

Payload generates both up and down SQL by calling Drizzle’s migration generator twice (forward and reverse), but the prompt doesn’t indicate direction:
https://unpkg.com/@payloadcms/[email protected]/dist/utilities/buildCreateMigration.js

Link to the code that reproduces this issue

https://unpkg.com/@payloadcms/[email protected]/dist/utilities/buildCreateMigration.js

Reproduction Steps

To Reproduce

  1. Have a collection using a blocks field with a block slug hero.
  2. Replace it with a new block slug post-hero (new block component), keeping existing data.
  3. Run PAYLOAD_CONFIG_PATH=src/payload.config.ts npx payload migrate:create.
  4. Observe the rename prompt above (it looks like it’s asking to create the old table).

Expected behavior

The prompt should clearly indicate whether it’s resolving the up or down migration, or label it as “reverse diff (down)” so users pick the rename option intentionally.
Alternatively, only prompt for renames for the up migration and derive the down renames automatically.

Actual behavior

The prompt is unlabeled, and the options include unrelated tables; it looks like the old table is being created even though the forward migration is a rename. This led to
confusion and wasted time.

Which area(s) are affected?

db: postgres

Environment Info

Binaries:
  Node: 22.19.0
  npm: 11.1.0
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  payload: 3.59.1
  next: 15.5.9
  @payloadcms/db-postgres: 3.59.1
  @payloadcms/drizzle: 3.59.1
  @payloadcms/email-nodemailer: 3.59.1
  @payloadcms/graphql: 3.59.1
  @payloadcms/next/utilities: 3.59.1
  @payloadcms/payload-cloud: 3.59.1
  @payloadcms/plugin-form-builder: 3.59.1
  @payloadcms/plugin-import-export: 3.59.1
  @payloadcms/plugin-redirects: 3.59.1
  @payloadcms/richtext-lexical: 3.59.1
  @payloadcms/translations: 3.59.1
  @payloadcms/ui/shared: 3.59.1
  react: 19.2.3
  react-dom: 19.2.3
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:55 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T8103
  Available memory (MB): 8192
  Available CPU cores: 8

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs-triagePossible bug which hasn't been reproduced yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions