You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When adding a PropertyOption (e.g. comment) to an existing @Enum decorator, it causes the PostgreSQL driver to drop it if it already exists.
To Reproduce
Steps to reproduce the behavior:
declare an enum and generate a migration
@Enum(() => SomeEnum)
someEnum: SomeEnum
Update it as follows and generate another migration
@Enum({ items: () => SomeEnum, comment: 'this is a comment' })
someEnum: SomeEnum
The second migration will have generated SQL to drop the check constraint generated by the first one
Expected behavior
Adding property options in the @Enum decorator unrelated to the enum, should not cause constraint dropping.
Additional context
Seems to me like the bug comes from here where every change in the property options will cause it to drop the constraint, even if the change is unrelated to the constraint.
Versions
Dependency
Version
node
16.14.2
typescript
1.22.15
mikro-orm
5.6.8
your-driver
PostgreSQL
The text was updated successfully, but these errors were encountered:
yeedle
changed the title
Adding a comment to @Enum ignores (or drops) the check constraint with PostgreSQL driver
Adding a proprty option to @Enum drops existing check constraint with PostgreSQL driver
Mar 9, 2023
Describe the bug
When adding a
PropertyOption
(e.g.comment
) to an existing@Enum
decorator, it causes the PostgreSQL driver to drop it if it already exists.To Reproduce
Steps to reproduce the behavior:
Expected behavior
Adding property options in the
@Enum
decorator unrelated to the enum, should not cause constraint dropping.Additional context
Seems to me like the bug comes from here where every change in the property options will cause it to drop the constraint, even if the change is unrelated to the constraint.
Versions
The text was updated successfully, but these errors were encountered: