Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,12 @@ If that is the case, the example queries will be prefixed with an option to choo
// * <<query-plan-set-relationship-properties-from-map, SetRelationshipPropertiesFromMap>>
// * <<query-plan-set-property, SetProperty>>
// * <<query-plan-create-unique-constraint, CreateUniqueConstraint>>
// * <<query-plan-drop-unique-constraint, DropUniqueConstraint (deprecated)>>
// * <<query-plan-create-node-property-existence-constraint, CreateNodePropertyExistenceConstraint>>
// * <<query-plan-drop-node-property-existence-constraint, DropNodePropertyExistenceConstraint (deprecated)>>
// * <<query-plan-create-node-key-constraint, CreateNodeKeyConstraint>>
// * <<query-plan-drop-node-key-constraint, DropNodeKeyConstraint (deprecated)>>
// * <<query-plan-create-relationship-property-existence-constraint, CreateRelationshipPropertyExistenceConstraint>>
// * <<query-plan-drop-relationship-property-existence-constraint, DropRelationshipPropertyExistenceConstraint (deprecated)>>
// * <<query-plan-drop-constraint-by-name, DropConstraint>>
// * <<query-plan-drop-constraint, DropConstraint>>
// * <<query-plan-create-index, CreateIndex>>
// * <<query-plan-drop-index, DropIndex (deprecated)>>
// * <<query-plan-drop-index-by-name, DropIndex>>
// * <<query-plan-drop-index, DropIndex>>

include::../ql/query-plan/all-nodes-scan.asciidoc[]

Expand Down Expand Up @@ -289,38 +284,23 @@ include::../ql/query-plan/set-property.asciidoc[]

include::../ql/query-plan/create-unique-constraint.asciidoc[]

[role=deprecated]
include::../ql/query-plan/drop-unique-constraint.asciidoc[]

include::../ql/query-plan/create-constraint-only-if-it-does-not-already-exist.asciidoc[]

include::../ql/query-plan/create-node-property-existence-constraint.asciidoc[]

[role=deprecated]
include::../ql/query-plan/drop-node-property-existence-constraint.asciidoc[]

include::../ql/query-plan/create-node-key-constraint.asciidoc[]

[role=deprecated]
include::../ql/query-plan/drop-node-key-constraint.asciidoc[]

include::../ql/query-plan/create-relationship-property-existence-constraint.asciidoc[]

[role=deprecated]
include::../ql/query-plan/drop-relationship-property-existence-constraint.asciidoc[]

include::../ql/query-plan/drop-constraint-by-name.asciidoc[]
include::../ql/query-plan/drop-constraint.asciidoc[]

include::../ql/query-plan/listing-constraints.asciidoc[]

include::../ql/query-plan/create-index.asciidoc[]

include::../ql/query-plan/create-index-only-if-it-does-not-already-exist.asciidoc[]

[role=deprecated]
include::../ql/query-plan/drop-index-by-schema.asciidoc[]

include::../ql/query-plan/drop-index-by-name.asciidoc[]
include::../ql/query-plan/drop-index.asciidoc[]

include::../ql/query-plan/listing-indexes.asciidoc[]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,48 +142,18 @@ Tests for the absence of a pattern predicate.
|
|

| <<query-plan-drop-index-by-schema,DropIndex>>
| Drops an index from a property for all nodes having a certain label.
| label:yes[]
| label:yes[]
| label:deprecated[]

| <<query-plan-drop-index-by-name,DropIndex>>
| <<query-plan-drop-index,DropIndex>>
| Drops an index using its name.
| label:yes[]
| label:yes[]
|

| <<query-plan-drop-constraint-by-name,DropConstraint>>
| <<query-plan-drop-constraint,DropConstraint>>
| Drops a constraint using its name.
| label:yes[]
| label:yes[]
|

| <<query-plan-drop-node-key-constraint,DropNodeKeyConstraint>>
| Drops a node key constraint from a set of properties for all nodes having a certain label.
| label:yes[]
| label:yes[]
| label:deprecated[]

| <<query-plan-drop-node-property-existence-constraint,DropNodePropertyExistenceConstraint>>
| Drops an existence constraint from a property for all nodes having a certain label.
| label:yes[]
| label:yes[]
| label:deprecated[]

| <<query-plan-drop-relationship-property-existence-constraint,DropRelationshipPropertyExistenceConstraint>>
| Drops an existence constraint from a property for all relationships of a certain type.
| label:yes[]
| label:yes[]
| label:deprecated[]

| <<query-plan-drop-unique-constraint,DropUniqueConstraint>>
| Drops a unique constraint from a set of properties for all nodes having a certain label.
| label:yes[]
| label:yes[]
| label:deprecated[]

| <<query-plan-eager,Eager>>
| For isolation purposes, `Eager` ensures that operations affecting subsequent operations are executed fully for the whole dataset before continuing execution.
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,21 +182,6 @@ SHOW [ALL\|BTREE\|FULLTEXT\|LOOKUP\|TEXT] INDEX[ES]
| List indexes in the database, either all or filtered on index type.
| When using the `RETURN` clause, the `YIELD` clause is mandatory and must not be omitted.

| [source, cypher, role=noplay]
----
DROP INDEX ON :LabelName(propertyName)
----
| Drop a single-property index on nodes without specifying a name.
.2+.^| [deprecated]#This syntax is deprecated.#

| [source, cypher, role=noplay]
----
DROP INDEX ON :LabelName (n.propertyName_1,
n.propertyName_2,
n.propertyName_n)
----
| Drop a composite index on nodes without specifying a name.
|===

Creating an index requires <<administration-security-administration-database-indexes, the `CREATE INDEX` privilege>>,
Expand Down Expand Up @@ -547,17 +532,3 @@ include::../indexes/create-a-point-index-specifying-the-index-provider.asciidoc[
include::../indexes/create-a-point-index-specifying-the-index-configuration.asciidoc[leveloffset=+1]

include::../indexes/create-a-point-index-specifying-both-the-index-provider-and-configuration.asciidoc[leveloffset=+1]


[role=deprecated]
[[administration-indexes-examples-deprecated-syntax]]
== Deprecated syntax

[NOTE]
====
This syntax only supports dropping b-tree node property indexes, all others can only be dropped by name.
====

include::../indexes/drop-a-single-property-index.asciidoc[leveloffset=+1]

include::../indexes/drop-a-composite-index.asciidoc[leveloffset=+1]
12 changes: 0 additions & 12 deletions cypher/cypher-docs/src/docs/dev/ql/constraints/examples.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -148,29 +148,17 @@ include::../administration/constraints/listing-constraints-with-filtering.asciid
[discrete]
include::../administration/constraints/create-a-unique-constraint-using-deprecated-syntax.asciidoc[leveloffset=+1]

[discrete]
include::../administration/constraints/drop-a-unique-constraint.asciidoc[leveloffset=+1]

[discrete]
include::../administration/constraints/create-a-node-property-existence-constraint-using-deprecated-syntax-1.asciidoc[leveloffset=+1]

[discrete]
include::../administration/constraints/create-a-node-property-existence-constraint-using-deprecated-syntax-2.asciidoc[leveloffset=+1]

[discrete]
include::../administration/constraints/drop-a-node-property-existence-constraint.asciidoc[leveloffset=+1]

[discrete]
include::../administration/constraints/create-a-relationship-property-existence-constraint-using-deprecated-syntax-1.asciidoc[leveloffset=+1]

[discrete]
include::../administration/constraints/create-a-relationship-property-existence-constraint-using-deprecated-syntax-2.asciidoc[leveloffset=+1]

[discrete]
include::../administration/constraints/drop-a-relationship-property-existence-constraint.asciidoc[leveloffset=+1]

[discrete]
include::../administration/constraints/create-a-node-key-constraint-using-deprecated-syntax.asciidoc[leveloffset=+1]

[discrete]
include::../administration/constraints/drop-a-node-key-constraint.asciidoc[leveloffset=+1]
67 changes: 1 addition & 66 deletions cypher/cypher-docs/src/docs/dev/ql/constraints/syntax.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,7 @@ Index provider and configuration can be specified using the `OPTIONS` clause.
[[administration-constraints-syntax-drop]]
== Syntax for dropping constraints

[discrete]
=== Drop a constraint

The preferred way of dropping a constraint is by the name of the constraint.
Dropping a constraint is done by the name of the constraint.

This drop command is optionally idempotent, with the default behavior to throw an error if you attempt to drop the same constraint twice.
With the `IF EXISTS` flag, no error is thrown and nothing happens should the constraint not exist.
Expand All @@ -136,68 +133,6 @@ Dropping a constraint requires the <<administration-security-administration-data
DROP CONSTRAINT constraint_name [IF EXISTS]
----

[discrete]
=== [deprecated]#Drop a unique constraint without specifying a name#

An old way of dropping a uniqueness constraint was to drop the constraint by specifying the schema of the constraint.

[source, cypher, role=noplay]
----
DROP CONSTRAINT
ON (n:LabelName)
ASSERT n.propertyName IS UNIQUE
----

[source, cypher, role=noplay]
----
DROP CONSTRAINT
ON (n:LabelName)
ASSERT (n.propertyName_1, … n.propertyName_n) IS UNIQUE
----

[discrete]
=== [deprecated]#Drop a node property existence constraint without specifying a name#

An old way of dropping a node property existence constraint was to drop the constraint by specifying the schema of the constraint.

[source, cypher, role=noplay]
----
DROP CONSTRAINT
ON (n:LabelName)
ASSERT EXISTS (n.propertyName)
----

[discrete]
=== [deprecated]#Drop a relationship property existence constraint without specifying a name#

An old way of dropping a relationship property existence constraint was to drop the constraint by specifying the schema of the constraint.

[source, cypher, role=noplay]
----
DROP CONSTRAINT
ON ()-"["r:RELATIONSHIP_TYPE"]"-()
ASSERT EXISTS (r.propertyName)
----

[discrete]
=== [deprecated]#Drop a node key constraint without specifying a name#

An old way of dropping a node key constraint was to drop the constraint by specifying the schema of the constraint.

[source, cypher, role=noplay]
----
DROP CONSTRAINT
ON (n:LabelName)
ASSERT n.propertyName IS NODE KEY
----

[source, cypher, role=noplay]
----
DROP CONSTRAINT
ON (n:LabelName)
ASSERT (n.propertyName_1, … n.propertyName_n) IS NODE KEY
----


[[administration-constraints-syntax-list]]
== Syntax for listing constraints
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,6 @@ class ConstraintsTest extends DocumentingTestBase with SoftReset {
)
}

@Test def drop_unique_constraint() {
generateConsole = false

prepareAndTestQuery(
title = "Drop a unique constraint",
text = "By using `DROP CONSTRAINT`, a b-tree index-backed unique constraint is removed from the database.",
queryText = "DROP CONSTRAINT ON (book:Book) ASSERT book.isbn IS UNIQUE",
prepare = _ => executePreparationQueries(List("CREATE CONSTRAINT FOR (book:Book) REQUIRE book.isbn IS UNIQUE")),
assertions = _ => assertNodeConstraintDoesNotExist("Book", "isbn")
)
}

@Test def play_nice_with_unique_property_constraint() {
generateConsole = false

Expand Down Expand Up @@ -245,18 +233,6 @@ class ConstraintsTest extends DocumentingTestBase with SoftReset {
)
}

@Test def drop_node_property_existence_constraint() {
generateConsole = false

prepareAndTestQuery(
title = "Drop a node property existence constraint",
text = "By using `DROP CONSTRAINT`, a node property existence constraint is removed from the database.",
queryText = "DROP CONSTRAINT ON (book:Book) ASSERT exists(book.isbn)",
prepare = _ => executePreparationQueries(List("CREATE CONSTRAINT FOR (book:Book) REQUIRE book.isbn IS NOT NULL")),
assertions = _ => assertNodeConstraintDoesNotExist("Book", "isbn")
)
}

@Test def play_nice_with_node_property_existence_constraint() {
generateConsole = false

Expand Down Expand Up @@ -347,18 +323,6 @@ class ConstraintsTest extends DocumentingTestBase with SoftReset {
)
}

@Test def drop_relationship_property_existence_constraint() {
generateConsole = false

prepareAndTestQuery(
title = "Drop a relationship property existence constraint",
text = "To remove a relationship property existence constraint from the database, use `DROP CONSTRAINT`.",
queryText = "DROP CONSTRAINT ON ()-[like:LIKED]-() ASSERT exists(like.day)",
prepare = _ => executePreparationQueries(List("CREATE CONSTRAINT FOR ()-[like:LIKED]-() REQUIRE like.day IS NOT NULL")),
assertions = _ => assertRelationshipConstraintDoesNotExist("LIKED", "day")
)
}

@Test def play_nice_with_relationship_property_existence_constraint() {
generateConsole = false

Expand Down Expand Up @@ -486,18 +450,6 @@ class ConstraintsTest extends DocumentingTestBase with SoftReset {
)
}

@Test def drop_node_key_constraint() {
generateConsole = false

prepareAndTestQuery(
title = "Drop a node key constraint",
text = "Use `DROP CONSTRAINT` to remove a b-tree index-backed node key constraint from the database.",
queryText = "DROP CONSTRAINT ON (n:Person) ASSERT (n.firstname, n.surname) IS NODE KEY",
prepare = _ => executePreparationQueries(List("CREATE CONSTRAINT FOR (n:Person) REQUIRE (n.firstname, n.surname) IS NODE KEY")),
assertions = _ => assertNodeKeyConstraintDoesNotExist("Person", "firstname", "surname")
)
}

@Test def play_nice_with_node_key_constraint() {
generateConsole = false

Expand Down Expand Up @@ -592,22 +544,10 @@ class ConstraintsTest extends DocumentingTestBase with SoftReset {
assert(hasNodeKeyConstraint(labelName, propNames.toSeq))
}

private def assertNodeConstraintDoesNotExist(labelName: String, propName: String) {
assert(!hasNodeConstraint(labelName, propName))
}

private def assertNodeKeyConstraintDoesNotExist(labelName: String, propNames: String*) {
assert(!hasNodeKeyConstraint(labelName, propNames.toSeq))
}

private def assertRelationshipConstraintExist(typeName: String, propName: String) {
assert(hasRelationshipConstraint(typeName, propName))
}

private def assertRelationshipConstraintDoesNotExist(typeName: String, propName: String) {
assert(!hasRelationshipConstraint(typeName, propName))
}

def assertConstraintWithNameExists(name: String, expectedLabelOrType: String, expectedProperties: List[String], forRelationship: Boolean = false) {
val transaction = db.beginTx()
try {
Expand Down
Loading