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

🐛 Bug: Metadata sync from MySQL ignores enum changes #8679

Open
1 task done
taeemo opened this issue Jun 9, 2024 · 1 comment
Open
1 task done

🐛 Bug: Metadata sync from MySQL ignores enum changes #8679

taeemo opened this issue Jun 9, 2024 · 1 comment

Comments

@taeemo
Copy link

taeemo commented Jun 9, 2024

Please confirm if bug report does NOT exist already ?

  • I confirm there is no existing issue for this

Steps to reproduce ?

  • Create a MySQL2 datasource and create the initial database
  • Edit the enum options in a specific table (e.g., add/remove options)
  • Sync metadata
  • At this point Noco will not detect any change.
  • Side note: even forcing another change at MySQL level such as adding a new fake temporary column, still won't reflect the enum changes. Renaming the column seems to trigger the detection of right enums as well, but that's not an option in production

Desired Behavior

  • The changes in the enum options should be detected
  • The changes to the enum should be reflected in the table

Project Details

Node: v20.11.1
Arch: x64
Platform: linux
Docker: true
RootDB: mysql2
PackageVersion: 0.207.0

Attachments

No response

@taeemo
Copy link
Author

taeemo commented Jun 9, 2024

So, it seems that the way we check the diff is not complete?
Here https://github.com/nocodb/nocodb/blob/develop/packages/nocodb/src/services/meta-diffs.service.ts#L244, we're checking just the type of the column. But in our case it's the same, enum, but different available options.

Apologies for the very crude/potentially wrong fix, but it seems that if we replace this condition

 if (oldCol.dt !== column.dt) {

with something like:

if (oldCol.dt !== column.dt ||
          oldCol.dt == 'enum' && oldCol.dtxp != column.dtxp
        ) {

It seems to fix the issue, and detect the change properly and is applied as expected.

image
image

Is this the right fix? Should I to submit a PR for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏌️ Open
Development

No branches or pull requests

1 participant