framework
framework copied to clipboard
Fix edge cases in steps.field_update when primaryKey and foreignKeys are renamed
- fixes #1560
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
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.