Hello!
First, thank you for creating and maintaining activegraph, we appreciate the work that goes into it.
We are upgrading to v12 (activegraph 12.0.0.beta.7, neo4j-ruby-driver 6.0.3.alpha.0, Neo4j 5 Enterprise) and encountered an unexpected error caused by relationship models being registered in MODEL_CONSTRAINTS.
Background
We have relationship models that do not define or use a uuid, they are only ever accessed through node traversal, never queried directly by ID. Before v12 this worked fine.
What changed in v12
In beta.1, ensure_id_property_info! was added to ActiveGraph::Relationship#initialize (commit bcc5165). This causes relationship classes to be registered in MODEL_CONSTRAINTS via handle_model_schema!. I believe when validate_model_schema! runs, it checks Neo4j for a corresponding uniqueness constraint but there is no constraint so the check always fails.
Error
ActiveGraph::DeprecatedSchemaDefinitionError:
Some schema elements were defined by the model (which is no longer supported),
but they do not exist in the database. Run the following to create them if you haven't already:
rake neo4j:generate_schema_migration[constraint,RELATIONSHIP,uuid]
And then run `rake neo4j:migrate`
Workaround
We worked around this by overriding ensure_id_property_info! on the affected relationship class to call super (preserving uuid assignment for new instances) and then removing the class from MODEL_CONSTRAINTS:
def self.ensure_id_property_info!
super
ActiveGraph::ModelSchema::MODEL_CONSTRAINTS.delete(self)
end
Questions
- Is this a known issue with the beta, or is there a supported way to opt relationship models out of the id property / constraint mechanism?
- What are your thoughts on the workaround — are there implications we may have missed?
- Would you consider adding a first-class opt-out for relationship models that don't need uuid identity, to avoid the need for this kind of patch?
Hello!
First, thank you for creating and maintaining activegraph, we appreciate the work that goes into it.
We are upgrading to v12 (activegraph 12.0.0.beta.7, neo4j-ruby-driver 6.0.3.alpha.0, Neo4j 5 Enterprise) and encountered an unexpected error caused by relationship models being registered in MODEL_CONSTRAINTS.
Background
We have relationship models that do not define or use a uuid, they are only ever accessed through node traversal, never queried directly by ID. Before v12 this worked fine.
What changed in v12
In beta.1,
ensure_id_property_info!was added to ActiveGraph::Relationship#initialize (commit bcc5165). This causes relationship classes to be registered in MODEL_CONSTRAINTS viahandle_model_schema!. I believe whenvalidate_model_schema!runs, it checks Neo4j for a corresponding uniqueness constraint but there is no constraint so the check always fails.Error
Workaround
We worked around this by overriding
ensure_id_property_info!on the affected relationship class to call super (preserving uuid assignment for new instances) and then removing the class from MODEL_CONSTRAINTS:Questions