Skip to content

Add optional SET keyword for create database clauses in Cypher 25 #2216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 4, 2025
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 @@ -36,6 +36,11 @@ See xref:database-internals/store-formats.adoc[Store formats], for more details

=== Syntax

[options="header", width="100%", cols="1m,5a"]
[.tabbed-example]
=====
[role=include-with-Cypher-5]
======
[options="header", width="100%", cols="1m,5a"]
|===
| Command | Syntax
Expand All @@ -57,8 +62,37 @@ CREATE OR REPLACE DATABASE name
[OPTIONS "{" option: value[, ...] "}"]
[WAIT [n [SEC[OND[S]]]]\|NOWAIT]
----
|===

======

[role=include-with-Cypher-25]
======

[options="header", width="100%", cols="1m,5a"]
|===
| Command | Syntax
| CREATE DATABASE
|
[source, syntax, role="noheader"]
----
CREATE DATABASE name [IF NOT EXISTS]
[[SET] TOPOLOGY n PRIMAR{Y\|IES} [m SECONDAR{Y\|IES}]]
[OPTIONS "{" option: value[, ...] "}"]
[WAIT [n [SEC[OND[S]]]]\|NOWAIT]
----

[source, syntax, role="noheader"]
----
CREATE OR REPLACE DATABASE name
[[SET] TOPOLOGY n PRIMAR{Y\|IES} [m SECONDAR{Y\|IES}]]
[OPTIONS "{" option: value[, ...] "}"]
[WAIT [n [SEC[OND[S]]]]\|NOWAIT]
----
|===

======
=====


[[manage-databases-create-database-options]]
Expand Down
131 changes: 123 additions & 8 deletions modules/ROOT/pages/database-administration/syntax.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ REQUIRE n.propertyName IS NOT NULL
[[administration-syntax-database-management]]
== Database management command syntax

The below table covers both standard and composite databases.
The database management commands are used to manage standard or composite databases.

=== Show databases

[options="header", width="100%", cols="1m,5a"]
|===
Expand All @@ -99,6 +101,17 @@ YIELD { * \| field[, ...] } [ORDER BY field[, ...]] [SKIP n] [LIMIT n]
[WHERE expression]
[RETURN field[, ...] [ORDER BY field[, ...]] [SKIP n] [LIMIT n]]
----
|===

=== Create a database

[.tabbed-example]
=====
[role=include-with-Cypher-5]
======
[options="header", width="100%", cols="1m,5a"]
|===
| Command | Syntax

| CREATE DATABASE
|
Expand All @@ -117,6 +130,42 @@ CREATE OR REPLACE DATABASE name
[OPTIONS "{" option: value[, ...] "}"]
[WAIT [n [SEC[OND[S]]]]\|NOWAIT]
----
|===

======

[role=include-with-Cypher-25]
======

[options="header", width="100%", cols="1m,5a"]
|===
| Command | Syntax
| CREATE DATABASE
|
[source, syntax, role="noheader"]
----
CREATE DATABASE name [IF NOT EXISTS]
[[SET] TOPOLOGY n PRIMAR{Y\|IES} [m SECONDAR{Y\|IES}]]
[OPTIONS "{" option: value[, ...] "}"]
[WAIT [n [SEC[OND[S]]]]\|NOWAIT]
----

[source, syntax, role="noheader"]
----
CREATE OR REPLACE DATABASE name
[[SET] TOPOLOGY n PRIMAR{Y\|IES} [m SECONDAR{Y\|IES}]]
[OPTIONS "{" option: value[, ...] "}"]
[WAIT [n [SEC[OND[S]]]]\|NOWAIT]
----
|===

======
=====
=== Create a composite database

[options="header", width="100%", cols="2m,4a"]
|===
| Command | Syntax

| CREATE COMPOSITE DATABASE
|
Expand All @@ -133,6 +182,13 @@ CREATE OR REPLACE COMPOSITE DATABASE name
[OPTIONS "{" "}"]
[WAIT [n [SEC[OND[S]]]]\|NOWAIT]
----
|===

=== Alter a database

[options="header", width="100%", cols="1m,5a"]
|===
| Command | Syntax

| ALTER DATABASE
|
Expand All @@ -158,21 +214,41 @@ REMOVE OPTION option
====
There can be multiple `SET OPTION` or `REMOVE OPTION` clauses for different option keys.
====
|===

=== Stop a database

[options="header", width="100%", cols="1m,5a"]
|===
| Command | Syntax

| STOP DATABASE
|
[source, syntax, role="noheader"]
----
STOP DATABASE name [WAIT [n [SEC[OND[S]]]]\|NOWAIT]
----
|===

=== Start a database

[options="header", width="100%", cols="1m,5a"]
|===
| Command | Syntax

| START DATABASE
|
[source, syntax, role="noheader"]
----
START DATABASE name [WAIT [n [SEC[OND[S]]]]\|NOWAIT]
----
|===

=== Delete a database

[options="header", width="100%", cols="1m,5a"]
|===
| Command | Syntax

| DROP DATABASE
|
Expand All @@ -186,10 +262,14 @@ DROP [COMPOSITE] DATABASE name [IF EXISTS] [RESTRICT \| CASCADE ALIAS[ES]] [{DUM
[[administration-syntax-database-alias-management]]
== Database alias management command syntax

[options="header", width="100%", cols="1,5a"]
The database alias management commands are used to manage local or remote database aliases.

=== Show aliases

[options="header", width="100%", cols="1m,5a"]
|===
| Command | Syntax
| Show Database Alias
| SHOW ALIAS
|
[source, syntax, role=noheader]
-----
Expand All @@ -204,8 +284,15 @@ YIELD { * \| field[, ...] } [ORDER BY field[, ...]] [SKIP n] [LIMIT n]
[RETURN field[, ...] [ORDER BY field[, ...]] [SKIP n] [LIMIT n]]
-----
Lists both local and remote database aliases, optionally filtered on the alias name.
|===

=== Create a local alias

| Create Local Alias
[options="header", width="100%", cols="1m,5a"]
|===
| Command | Syntax

| CREATE ALIAS
|
[source, syntax, role=noheader]
-----
Expand All @@ -217,8 +304,15 @@ CREATE ALIAS name [IF NOT EXISTS] FOR DATABASE targetName
CREATE OR REPLACE ALIAS name FOR DATABASE targetName
[PROPERTIES "{" key: value[, ...] "}"]
-----
|===

=== Create a remote alias

| Create Remote Alias
[options="header", width="100%", cols="1m,5a"]
|===
| Command | Syntax

| CREATE ALIAS
|
[source, syntax, role=noheader]
-----
Expand All @@ -234,17 +328,30 @@ AT 'url' USER username PASSWORD 'password'
[DRIVER "{" setting: value[, ...] "}"]
[PROPERTIES "{" key: value[, ...] "}"]
-----
|===

=== Alter a local alias

| Alter Local Alias
[options="header", width="100%", cols="1m,5a"]
|===
| Command | Syntax

|ALTER ALIAS
|
[source, syntax, role=noheader]
-----
ALTER ALIAS name [IF EXISTS] SET DATABASE
[TARGET targetName]
[PROPERTIES "{" key: value[, ...] "}"]
-----
|===

| Alter Remote Alias
=== Alter a remote alias

[options="header", width="100%", cols="1m,5a"]
|===
| Command | Syntax
|ALTER ALIAS
|
[source, syntax, role=noheader]
-----
Expand All @@ -256,7 +363,15 @@ ALTER ALIAS name [IF EXISTS] SET DATABASE
[PROPERTIES "{" key: value[, ...] "}"]
-----

| Drop Alias
|===

=== Delete an alias

[options="header", width="100%", cols="1m,5a"]
|===
| Command | Syntax

| DROP ALIAS
|
[source, syntax, role=noheader]
-----
Expand Down