bug: duplicated inherited schema rels and attrs prevent schema updates #5793
Labels
priority/2
This issue stalls work on the project or its dependents, it's a blocker for a release
state/planned
This issue is planned to be worked on in an upcoming release.
Milestone
We prevent updating relationships and attributes on generic nodes and the schema nodes that inherit from the generic nodes correctly b/c of duplicated information in the database. Updating a relationship/attribute identifier/name requires including an ID in the schema and that ID corresponds to a {{SchemaRelationship}} or {{SchemaAttribute}} node in the database. But if these attributes/relationships are duplicated on the database, then there are multiple nodes with different IDs associated with the relationship/attribute and that prevents the schema update from functioning correctly
We save inherited relationships and attributes on both the {{SchemaGeneric}} node that defines them and the {{SchemaNode}} node that inherits them. This is duplicative. We only need to save them on the {{SchemaGeneric}} and the logic for loading/updating a schema in memory can handle adding/update the inherited relationships/attributes in memory.
here is a semi-helpful database screenshot of the problem. The red node is a {{SchemaGeneric}} and the green node is {{SchemaNode}} that inherits from that generic.
!image-20250131-185316.png|width=75%,alt="image-20250131-185316.png"!
the problem areas of the code are the {{load_node_to_db}}, {{update_node_in_db}}, and {{update_node_in_db_based_on_diff}} methods of the {{SchemaBranch}} class. they use {{node.attributes}} and {{node.relationships}} where they should use {{node.local_attributes}} and {{node.local_relationships}}, which exclude the inherited attributes/relationships.
this change will also require a migration to remove the duplicated data from existing databases.
The text was updated successfully, but these errors were encountered: