Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
JPryce-Aklundh committed Sep 23, 2024
1 parent 425c015 commit 5c8da1d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion modules/ROOT/pages/constraints/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ label:enterprise-edition[]
* *Property type constraints* ensure that a property has the required property type for all nodes with a specific label or for all relationships with a specific type. label:enterprise-edition[]
* *Key constraints* ensure that property values are unique and exists for all nodes with a specific label or all relationships with a specific type. label:enterprise-edition[]
To learn more about creating, listing, and dropping these constraints, as well as information about index-backed constraints, sonstraint creation failures and data violation scenarios, and more, see xref:constraints/managing-constraints.adoc[].
To learn more about creating, listing, and dropping these constraints, as well as information about index-backed constraints, constraint creation failures and data violation scenarios, and more, see xref:constraints/managing-constraints.adoc[].

For reference material about the Cypher commands used to manage constraints, see xref:constraints/syntax.adoc[].

11 changes: 8 additions & 3 deletions modules/ROOT/pages/constraints/managing-constraints.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Single property uniqueness constraints are created with the following commands:
* Relationship property uniqueness constraints: `CREATE CONSTRAINT constraint_name
FOR ()-[r:REL_TYPE]-() REQUIRE r.property IS UNIQUE`.

For the full command syntax to create a uniqueness constraint, see xref:constraints/syntax.adoc#create-property-uniqueness-constraints[Syntax -> Create property uniqueness constraint].
For the full command syntax to create a uniqueness constraint, see xref:constraints/syntax.adoc#create-property-uniqueness-constraints[Syntax -> Create property uniqueness constraints].

.Create a node property uniqueness constraint on a single property
======
Expand Down Expand Up @@ -561,6 +561,8 @@ FOR (n:Label) REQUIRE (n.propertyName_1, ..., n.propertyName_n) NODE KEY`.
* Relationship key constraints: `CREATE CONSTRAINT constraint_name
FOR ()-[r:REL_TYPE]-() REQUIRE (r.propertyName_1, ..., r.propertyName_n) IS RELATIONSHIP KEY`.

For the full command syntax to create a key constraint, see xref:constraints/syntax.adoc#create-key-constraints[Syntax -> Create key constraints].

.Create a composite node key constraint on multiple properties
======
Expand Down Expand Up @@ -712,7 +714,7 @@ Single property constraints will create single property indexes and multiple pro

[NOTE]
Indexes of the same index type, label/relationship type, and property combination cannot be added separately.
However, dropping a key or uniqueness constraint will also drop its backing index.
However, dropping a property uniqueness or key constraint will also drop its backing index.
If the backing index is still required, the index needs to be explicitly re-created.

Property uniqueness and key constraints require an index because it allows the system to quickly check if a node with the same label and property value or a relationship with the same type and property value already exists.
Expand Down Expand Up @@ -1256,6 +1258,7 @@ Constraint( id=10, name='preExisting_actor_name_age', type='UNIQUENESS', schema=

To list all constraints with the default output columns, use `SHOW CONSTRAINTS`.
If all columns are required, use `SHOW CONSTRAINTS YIELD *`.
For the full command syntax to list constraints, see xref:constraints/syntax.adoc#list-constraints[Syntax -> SHOW CONSTRAINTS].

One of the output columns from `SHOW CONSTRAINTS` is the name of the constraint.
This can be used to drop the constraint with the xref::constraints/syntax.adoc#constraints-syntax-drop[`DROP CONSTRAINT` command].
Expand Down Expand Up @@ -1381,7 +1384,7 @@ SHOW KEY CONSTRAINTS
+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
----
For a full list of all the constraint types (and synonyms) available in this command see xref:constraints/syntax.adoc#constraints-syntax-list[syntax for listing constraints].
For a full list of all the constraint types (and synonyms) available in this command see xref:constraints/syntax.adoc#list-constraints[Syntax -> SHOW CONSTRAINTS].
======

Expand Down Expand Up @@ -1460,6 +1463,7 @@ WHERE entityType = 'RELATIONSHIP'
======


[[list-constraints-result-columns]]
=== Result columns for listing constraints

Expand Down Expand Up @@ -1515,6 +1519,7 @@ label:default-output[] label:new[Introduced in 5.9]
== DROP CONSTRAINT

Constraints are dropped using the `DROP CONSTRAINT` command.
For the full command syntax to drop constraints, see xref:constraints/syntax.adoc#drop-constraint[Syntax -> DROP CONSTRAINT].

[NOTE]
Dropping a constraint requires the link:{neo4j-docs-base-uri}/operations-manual/{page-version}/authentication-authorization/database-administration/#access-control-database-administration-constraints[`DROP CONSTRAINT` privilege].
Expand Down
11 changes: 7 additions & 4 deletions modules/ROOT/pages/constraints/syntax.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ REQUIRE (r.propertyName_1, ..., r.propertyName_n) IS [REL[ATIONSHIP]] UNIQUE
[OPTIONS "{" option: value[, ...] "}"]
----

For more examples on how to create property uniqueness constraints, see xref:constraints/managing-constraints.adoc#create-property-uniqueness-constraints[Create, show, and drop constraints -> Create property uniqueness constraint].
For examples on how to create property uniqueness constraints, see xref:constraints/managing-constraints.adoc#create-property-uniqueness-constraints[Create, show, and drop constraints -> Create property uniqueness constraint].
Property uniqueness constraints are xref:constraints/managing-constraints.adoc#constraints-and-indexes[index-backed].

[role=label--enterprise-edition]
Expand All @@ -91,7 +91,7 @@ REQUIRE r.propertyName IS NOT NULL

There are no supported `OPTIONS` values for property existence constraints, but an empty options map is allowed for consistency.

For more examples on how to create property existence constraints, see xref:constraints/managing-constraints.adoc#create-property-existence-constraints[Create, show, and drop constraints -> Create property existence constraints].
For examples on how to create property existence constraints, see xref:constraints/managing-constraints.adoc#create-property-existence-constraints[Create, show, and drop constraints -> Create property existence constraints].

[role=label--enterprise-edition label--new-5.9]
[[create-property-type-constraints]]
Expand Down Expand Up @@ -148,7 +148,7 @@ Allowed syntax variations of these types are listed in xref::values-and-types/p

There are no supported `OPTIONS` values for property type constraints, but an empty options map is allowed for consistency.

For more examples on how to create property type constraints, see xref:constraints/managing-constraints.adoc#create-property-type-constraint[Create, show, and drop constraints -> Create property type constraints].
For examples on how to create property type constraints, see xref:constraints/managing-constraints.adoc#create-property-type-constraint[Create, show, and drop constraints -> Create property type constraints].


[role=label--enterprise-edition]
Expand Down Expand Up @@ -193,7 +193,7 @@ REQUIRE (r.propertyName_1, ..., r.propertyName_n) IS [REL[ATIONSHIP]] KEY

An index provider can be specified using the `OPTIONS` clause.

For more examples on how to create key constraints, see xref:constraints/managing-constraints.adoc#create-key-constraints[Create, show, and drop constraints -> Create key constraints].
For examples on how to create key constraints, see xref:constraints/managing-constraints.adoc#create-key-constraints[Create, show, and drop constraints -> Create key constraints].
Key constraints are xref:constraints/managing-constraints.adoc#constraints-and-indexes[index-backed].


Expand Down Expand Up @@ -307,6 +307,8 @@ label:new[Introduced in 5.7]

|===

For examples on how to list constraints, see xref:constraints/managing-constraints.adoc#list-constraints[Create, show, and drop constraints -> SHOW CONSTRAINTS].

[[drop-constraint]]
== DROP CONSTRAINT

Expand All @@ -328,3 +330,4 @@ This means its default behavior is to throw an error if an attempt is made to dr
With the `IF EXISTS` flag, no error is thrown and nothing happens should the constraint not exist.
As of Neo4j 5.17, an informational notification is instead returned detailing that the constraint does not exist.

For examples on how to drop constraints, see xref:constraints/managing-constraints.adoc#drop-constraint[Create, show, and drop constraints -> DROP CONSTRAINT].

0 comments on commit 5c8da1d

Please sign in to comment.