Skip to content

native enum values are sometimes lower case #6643

@jroith

Description

@jroith

Describe the bug

Native enum migrations contain lower-cased values where they should be kept as specified and the migration accordingly fails.

Reproduction

I am creating migrations for models that contain native PostgreSQL enums.

Sometimes when a value is added - usually for the first value - the migration fails like this:

DriverException: alter type [...] add value if not exists 'NEW_VALUE' before 'old_value'; - "old_value" is not an existing enum label

The enum is actually uppercase for both the new and old values, so the error message is correct. For some reason the migration inserts a lower case value (but often only for the first old item).

export enum Test {
NEW_VALUE = "NEW_VALUE",
OLD_VALUE = "OLD_VALUE",
}

What driver are you using?

None

MikroORM version

6.4

Node.js version

22.0

Operating system

No response

Validations

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