Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a proprty option to @Enum drops existing check constraint with PostgreSQL driver #4112

Closed
yeedle opened this issue Mar 9, 2023 · 0 comments · Fixed by #5414
Closed
Labels
bug Something isn't working

Comments

@yeedle
Copy link
Contributor

yeedle commented 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:

  1. declare an enum and generate a migration
@Enum(() => SomeEnum)
someEnum: SomeEnum
  1. Update it as follows and generate another migration
@Enum({ items: () => SomeEnum, comment: 'this is a comment' })
someEnum: SomeEnum
  1. 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
@yeedle 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
@B4nan B4nan added the bug Something isn't working label Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants