mikro-orm
mikro-orm copied to clipboard
Adding a proprty option to @Enum drops existing check constraint with PostgreSQL driver
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 |