Skip to content

Commit

Permalink
Update grammar to use CREATE
Browse files Browse the repository at this point in the history
Add test for DROP
  • Loading branch information
Mats-SX committed Jul 26, 2019
1 parent 0ec02df commit 4ef7b32
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion grammar/commands.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<!-- / NEW CONSTRAINT SYNTAX \ -->

<production name="CreateConstraint">
ADD &SP; CONSTRAINT &SP; <non-terminal ref="ConstraintName"/> &SP;
CREATE &SP; CONSTRAINT &SP; <non-terminal ref="ConstraintName"/> &SP;
FOR &SP; <non-terminal ref="ConstraintPattern"/> &SP;
REQUIRE &SP; <non-terminal ref="ConstraintExpression"/>
</production>
Expand Down
13 changes: 7 additions & 6 deletions tools/grammar/src/test/resources/cypher.txt
Original file line number Diff line number Diff line change
Expand Up @@ -312,22 +312,23 @@ CALL db.labels() YIELD *
WHERE label CONTAINS 'User' AND foo + bar = foo
RETURN count(label) AS numLabels§
CALL db.labels() YIELD x WHERE label CONTAINS 'User' AND foo + bar = foo RETURN count(label) AS numLabels§
ADD CONSTRAINT foo
CREATE CONSTRAINT foo
FOR (p:Person)
REQUIRE UNIQUE p.name§
ADD CONSTRAINT baz
CREATE CONSTRAINT baz
FOR (p:Person)
REQUIRE exists(p.name)§
ADD CONSTRAINT cru
CREATE CONSTRAINT cru
FOR ()-[r:REL]-()
REQUIRE exists(r.property)§
DROP CONSTRAINT foo_bar_baz§
ADD CONSTRAINT nodeKey
CREATE CONSTRAINT nodeKey
FOR (n:Node)
REQUIRE NODE KEY n.prop§
ADD CONSTRAINT nodeKey
CREATE CONSTRAINT nodeKey
FOR (n:Node)
REQUIRE NODE KEY n.p1, n.p2, n.p3§
ADD CONSTRAINT nodeKey
CREATE CONSTRAINT nodeKey
FOR (n:Node)
REQUIRE NODE KEY n.p1 ,n.p2, n.p3§
DROP CONSTRAINT foo§

0 comments on commit 4ef7b32

Please sign in to comment.