neo4j-contrib/neomodel

Invalid constraint syntax, ON and ASSERT should not be used. Replace ON with FOR and ASSERT with REQUIRE

machavia opened this issue · 1 comments

Expected Behavior (Mandatory)

Apply constraints and indexes to the database

Actual Behavior (Mandatory)

I'm trying to create the following node:

class Language(StructuredNode):
    uid = UniqueIdProperty()
    name = StringProperty()
    code = StringProperty(unique_index=True, required=True)

When executing the neomodel_install_labels script I have the following error:

neo4j.exceptions.CypherSyntaxError: {code: Neo.ClientError.Statement.SyntaxError} {message: Invalid constraint syntax, ON and ASSERT should not be used. Replace ON with FOR and ASSERT with REQUIRE. (line 1, column 1 (offset: 0))
"CREATE CONSTRAINT on (n:Language) ASSERT n.uid IS UNIQUE"
 ^}

How to Reproduce the Problem

from neomodel import (config, StructuredNode, StringProperty, IntegerProperty, UniqueIdProperty, RelationshipTo)

class Language(StructuredNode):
    uid = UniqueIdProperty()
    name = StringProperty()
    code = StringProperty(unique_index=True, required=True)

then execute neomodel_install_labels.

Screenshots (where it's possibile)

image

Specifications (Mandatory)

Currently used versions

Versions

  • OS: MacOS 12.6 (Apple Silicon M1)
  • Library: 4.0.10
  • Neo4j: 5.2.0

This is fixed in the current state of the "main" branch, and will be available in the next release (5.0.0) that should be out very soon.