Skip to content

[BUG]:Drizzle does not track enum name change #4338

Open
@LinLiu9898

Description

@LinLiu9898

Report hasn't been filed before.

  • I have verified that the bug I'm about to report hasn't been filed before.

What version of drizzle-orm are you using?

0.33.0

What version of drizzle-kit are you using?

0.24.2

Other packages

No response

Describe the Bug

Drizzle does not correctly track enum name changes. For example, if I have the following enum definition:

export const enum1 = pgEnum('enum1', ['a']);

and I rename it to:

export const enum2 = pgEnum('enum2', ['a']);

However, if I then change the enum to be called enum3, Drizzle incorrectly asks:

~ enum1 › enum3             rename enum

This indicates that the intermediate renaming step (from enum1 to enum2) was not tracked properly.

Steps to Reproduce

Define an enum using pgEnum.

Rename the enum to a new name.

Run drizzle-kit generate

Observe that no changes are detected.

Rename the enum again to a third name.

Run drizzle-kit generate

Observe that the change is tracked incorrectly by referencing the original name instead of the most recent name.

Expected Behavior

Drizzle should correctly detect and track enum name changes, referencing the most recent name instead of the original name (e.g. it should ask:

~ enum2 › enum3             rename enum

Additional Context

Database Engine: PostgreSQL

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions