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

Fix edge cases in steps.field_update when primaryKey and foreignKeys are renamed #1598

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

fjuniorr
Copy link
Contributor

@fjuniorr fjuniorr commented Oct 5, 2023

This PR fixes two more edge cases when steps.field_update is updating either primary or foreign keys:

  • update of a non-primary key field name when the table schema has a primary key
  • update of the field name of a foreign key

@fjuniorr fjuniorr changed the title 1560/fix field update Fix edge cases in steps.field_update when primaryKey and foreignKeys are renamed Oct 5, 2023
@fjuniorr
Copy link
Contributor Author

fjuniorr commented Oct 9, 2023

I've added another test case that is currently failing that happens when the foreign key being updated has the same name of the referenced column:

FAILED tests/steps/field/test_field_update.py::test_step_field_update_referenced_as_foreign_key_with_same_name - AssertionError: assert [{'fields': [...'resource2'}}] == [{'fields': [...'resource2'}}]
  At index 0 diff: {'fields': ['country_name'], 'reference': {'fields': ['country_name'], 'resource': 'resource2'}} != {'fields': ['country_name'], 'reference': {'fields': ['name'], 'resource': 'resource2'}}
  Full diff:
    [
     {'fields': ['country_name'],
  -   'reference': {'fields': ['name'], 'resource': 'resource2'}},
  +   'reference': {'fields': ['country_name'], 'resource': 'resource2'}},
  ?                             ++++++++
    ]

I still need some time to investigate and propose a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update of primaryKey and foreignKeys when field is renamed
2 participants