Skip to content

Incorrect Constraints Query Generated #183

@ColtraneNadler

Description

@ColtraneNadler

Incorrect Constraints Query Generated

Versions

  • Neo4j Version 5.18.1
  • Neode Version 0.4.9

Problem

Incorrect constraints query being generated by

instance.model('MyNode', {
    customKey: {
        type: 'string',
        unique: true
    },
    mappings: 'string'
 });

instance.schema.install()

Runs the following cypher query

CREATE CONSTRAINT ON (model:MyNode) ASSERT model.customKey IS UNIQUE

which returns the following error ->

  error: Neo4jError: 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 (model:MyNode) ASSERT model.customKey IS UNIQUE"
   ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions