adam-cowley / neode

Neo4j OGM for Node.js
MIT License
394 stars 72 forks source link

update constraint syntax #184

Open ColtraneNadler opened 5 months ago

ColtraneNadler commented 5 months ago

Why?

Currently neode generates outdated CYPHER query syntax for unique constraints. View issue here --> https://github.com/adam-cowley/neode/issues/183

What?

in /src/Schema.js update to correct CONSTRAINT syntax. Replace ON with FOR and ASSERT with REQUIRE

function UniqueConstraintCypher(label, property, mode = 'CREATE') {
    // return `${mode} CONSTRAINT ON (model:${label}) ASSERT model.${property} IS UNIQUE`;
    return `${mode} CONSTRAINT FOR (model:${label}) REQUIRE model.${property} IS UNIQUE`;
}
ColtraneNadler commented 5 months ago

Bumping this