From 488a86dbfe876229c1b7d9e1faaeeed0693a66a7 Mon Sep 17 00:00:00 2001 From: Therese Magnusson Date: Tue, 3 Sep 2024 12:51:02 +0200 Subject: [PATCH 01/20] Add `DROP DATABASE name CASCADE ALIASES` to drop any aliases blocking the deletion of the database --- .../delete-composite-databases.adoc | 33 ++++++++++++- .../standard-databases/delete-databases.adoc | 46 +++++++++++++++++-- .../pages/database-administration/syntax.adoc | 2 +- 3 files changed, 76 insertions(+), 5 deletions(-) diff --git a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc index d1710a640..2b0d65f98 100644 --- a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc +++ b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc @@ -3,7 +3,7 @@ [[composite-databases-delete]] = Delete composite databases -You can delete composite databases using either the command `DROP COMPOSITE DATABASE name` or the more general one `DROP DATABASE name`. +You can delete composite databases using either the command `DROP COMPOSITE DATABASE name` or the more general one `DROP DATABASE name`. However, keep in mind that the first command will fail if the target database is not composite, while the second one will not fail because it targets any database. .Query @@ -12,3 +12,34 @@ However, keep in mind that the first command will fail if the target database is DROP COMPOSITE DATABASE inventory ---- +[[composite-databases-delete-with-aliases]] +== Delete a composite database with constituent database aliases + +In general, deleting a composite database that has constituent database aliases will fail due to those database aliases. +This affects both the local and remote constituent database aliases belonging to the specified composite database. + +By appending `CASCADE ALIASES` to the command `DROP COMPOSITE DATABASE`, those constituent database aliases can be dropped together with the composite database. +This affects both the local and remote constituent database aliases belonging to the specified composite database. + +Given composite database and database alias: +[source, cypher] +---- +CREATE COMPOSITE DATABASE movies +CREATE ALIAS movies.sweden FOR DATABASE `swedish-movies` +---- + +Then both the constituent database alias `sweden` and the composite database `movies` will be dropped with: +[source, cypher] +---- +DROP COMPOSITE DATABASE movies CASCADE ALIASES +---- + +This behaviour would be the same for the more general one `DROP DATABASE name` as well when using it to drop composite databases. + +The option `RESTRICT` explicitly requests the default behavior of the command. + +[NOTE] +==== +The `CASCADE ALIASES` option will drop the same aliases that would be given in the error message from trying to drop the database using the `RESTRICT` mode instead. +==== + diff --git a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc index 47667ff2f..2d4c523e9 100644 --- a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc +++ b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc @@ -17,7 +17,7 @@ Note that all database aliases must be dropped before dropping a database. | [source, syntax, role="noheader"] ---- -DROP [COMPOSITE] DATABASE name [IF EXISTS] [{DUMP\|DESTROY} [DATA]] [WAIT [n [SEC[OND[S]]]]\|NOWAIT] +DROP [COMPOSITE] DATABASE name [IF EXISTS] [RESTRICT \| CASCADE ALIAS[ES]] [{DUMP\|DESTROY} [DATA]] [WAIT [n [SEC[OND[S]]]]\|NOWAIT] ---- |=== @@ -92,9 +92,9 @@ In Neo4j, dumps can be stored in the directory specified by the xref:configurati The option `DESTROY DATA` explicitly requests the default behavior of the command. [[delete-existing-db-with-dump]] -=== Delete a database with `IF{nbsp}EXISTS` and `DUMP DATA`/ `DESTROY DATA` +=== Delete a database with `IF{nbsp}EXISTS` and `DUMP DATA`/`DESTROY DATA` -The options `IF EXISTS` and `DUMP DATA`/ `DESTROY DATA` can also be combined. +The options `IF EXISTS` and `DUMP DATA`/`DESTROY DATA` can also be combined. An example could look like this: @@ -103,4 +103,44 @@ An example could look like this: DROP DATABASE customers IF EXISTS DUMP DATA ---- +[[delete-databases-with-aliases]] +=== Delete a database with local database aliases targeting it + +In general, deleting a database that is the target of any local database aliases will fail due to those database aliases. +Any remote database aliases targeting the database does not affect the deletion of the database. + +By appending `CASCADE ALIASES` to the command `DROP DATABASE`, those local database aliases can be dropped together with the database. +Any remote database aliases targeting the database will not be affected of the `CASCADE ALIASES`, they will simply no longer resolve their targets (which is the same behaviour as if you create them targeting a non-existing database). + +Given database and database alias: +[source, cypher] +---- +CREATE DATABASE movies +CREATE ALIAS films FOR DATABASE movies +---- + +Then both the database alias `films` and the database `movies` will be dropped with: +[source, cypher] +---- +DROP DATABASE movies CASCADE ALIASES +---- + +The option `RESTRICT` explicitly requests the default behavior of the command. + +[NOTE] +==== +The `CASCADE ALIASES` option will drop the same aliases that would be given in the error message from trying to drop the database using the `RESTRICT` mode instead. +==== + +[[delete-existing-databases-with-aliases]] +=== Delete a database with `RESTRICT`/`CASCADE ALIASES` and other command parts + +The options `RESTRICT`/`CASCADE ALIASES` can also be combined with `IF EXISTS` and `DUMP DATA`/`DESTROY DATA`. + +An example could look like this: + +[source, cypher] +---- +DROP DATABASE movies IF EXISTS CASCADE ALIASES DUMP DATA +---- diff --git a/modules/ROOT/pages/database-administration/syntax.adoc b/modules/ROOT/pages/database-administration/syntax.adoc index e6c3ac7e9..ad6054aa0 100644 --- a/modules/ROOT/pages/database-administration/syntax.adoc +++ b/modules/ROOT/pages/database-administration/syntax.adoc @@ -176,7 +176,7 @@ START DATABASE name [WAIT [n [SEC[OND[S]]]]\|NOWAIT] | [source, syntax, role="noheader"] ---- -DROP [COMPOSITE] DATABASE name [IF EXISTS] [{DUMP\|DESTROY} [DATA]] [WAIT [n [SEC[OND[S]]]]\|NOWAIT] +DROP [COMPOSITE] DATABASE name [IF EXISTS] [RESTRICT \| CASCADE ALIAS[ES]] [{DUMP\|DESTROY} [DATA]] [WAIT [n [SEC[OND[S]]]]\|NOWAIT] ---- |=== From 5b7e27e66e68b62f1ec71e7c6f6f8ca6157ca55e Mon Sep 17 00:00:00 2001 From: Therese Magnusson Date: Wed, 4 Sep 2024 08:29:03 +0200 Subject: [PATCH 02/20] Add sentences about additional privileges --- .../composite-databases/delete-composite-databases.adoc | 2 ++ .../standard-databases/delete-databases.adoc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc index 2b0d65f98..50e85f1be 100644 --- a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc +++ b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc @@ -21,6 +21,8 @@ This affects both the local and remote constituent database aliases belonging to By appending `CASCADE ALIASES` to the command `DROP COMPOSITE DATABASE`, those constituent database aliases can be dropped together with the composite database. This affects both the local and remote constituent database aliases belonging to the specified composite database. +Using `CASCADE ALIASES` requires the `DROP ALIAS` privilege (see xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[ALIAS MANAGEMENT privileges]). + Given composite database and database alias: [source, cypher] ---- diff --git a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc index 2d4c523e9..be2ff6ebd 100644 --- a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc +++ b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc @@ -112,6 +112,8 @@ Any remote database aliases targeting the database does not affect the deletion By appending `CASCADE ALIASES` to the command `DROP DATABASE`, those local database aliases can be dropped together with the database. Any remote database aliases targeting the database will not be affected of the `CASCADE ALIASES`, they will simply no longer resolve their targets (which is the same behaviour as if you create them targeting a non-existing database). +Using `CASCADE ALIASES` requires the `DROP ALIAS` privilege (see xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[ALIAS MANAGEMENT privileges]). + Given database and database alias: [source, cypher] ---- From 994f3b9d0bcc97f1efd8d80aadd225f3bb3a1073 Mon Sep 17 00:00:00 2001 From: Therese Magnusson Date: Wed, 4 Sep 2024 12:29:18 +0200 Subject: [PATCH 03/20] Apply suggestions from code review Co-authored-by: Mark Dixon <1756429+mnd999@users.noreply.github.com> --- .../composite-databases/delete-composite-databases.adoc | 8 ++++---- .../standard-databases/delete-databases.adoc | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc index 50e85f1be..21ed7698d 100644 --- a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc +++ b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc @@ -15,10 +15,10 @@ DROP COMPOSITE DATABASE inventory [[composite-databases-delete-with-aliases]] == Delete a composite database with constituent database aliases -In general, deleting a composite database that has constituent database aliases will fail due to those database aliases. -This affects both the local and remote constituent database aliases belonging to the specified composite database. +In general, deleting a composite database that has constituent database aliases will fail as these aliases need to be dropped first. +This applies to both the local and remote constituent database aliases belonging to the specified composite database. -By appending `CASCADE ALIASES` to the command `DROP COMPOSITE DATABASE`, those constituent database aliases can be dropped together with the composite database. +By appending `CASCADE ALIASES` to the command `DROP COMPOSITE DATABASE`, those constituent database aliases can be dropped alongside the composite database. This affects both the local and remote constituent database aliases belonging to the specified composite database. Using `CASCADE ALIASES` requires the `DROP ALIAS` privilege (see xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[ALIAS MANAGEMENT privileges]). @@ -36,7 +36,7 @@ Then both the constituent database alias `sweden` and the composite database `mo DROP COMPOSITE DATABASE movies CASCADE ALIASES ---- -This behaviour would be the same for the more general one `DROP DATABASE name` as well when using it to drop composite databases. +This behavior would be the same for the more general command `DROP DATABASE name` when using it to drop a composite database. The option `RESTRICT` explicitly requests the default behavior of the command. diff --git a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc index be2ff6ebd..089d378c1 100644 --- a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc +++ b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc @@ -106,11 +106,11 @@ DROP DATABASE customers IF EXISTS DUMP DATA [[delete-databases-with-aliases]] === Delete a database with local database aliases targeting it -In general, deleting a database that is the target of any local database aliases will fail due to those database aliases. -Any remote database aliases targeting the database does not affect the deletion of the database. +In general, deleting a database that is the target of any local database aliases will fail due as these aliases need to be dropped first. +Remote database aliases targeting the database do not affect the deletion of the database. -By appending `CASCADE ALIASES` to the command `DROP DATABASE`, those local database aliases can be dropped together with the database. -Any remote database aliases targeting the database will not be affected of the `CASCADE ALIASES`, they will simply no longer resolve their targets (which is the same behaviour as if you create them targeting a non-existing database). +By appending `CASCADE ALIASES` to the command `DROP DATABASE`, those local database aliases can be dropped alongside the database. +Any remote database aliases targeting the database will not be affected of the `CASCADE ALIASES`, they will simply no longer resolve their targets (which is the same behavior as if they are created targeting a non-existing database). Using `CASCADE ALIASES` requires the `DROP ALIAS` privilege (see xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[ALIAS MANAGEMENT privileges]). From 41be4e422367e224362b7ce9f33a94853502c974 Mon Sep 17 00:00:00 2001 From: Therese Magnusson Date: Thu, 5 Sep 2024 11:55:02 +0200 Subject: [PATCH 04/20] Address review comments --- .../composite-databases/delete-composite-databases.adoc | 3 ++- .../standard-databases/delete-databases.adoc | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc index 21ed7698d..17a704b5c 100644 --- a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc +++ b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc @@ -20,6 +20,7 @@ This applies to both the local and remote constituent database aliases belonging By appending `CASCADE ALIASES` to the command `DROP COMPOSITE DATABASE`, those constituent database aliases can be dropped alongside the composite database. This affects both the local and remote constituent database aliases belonging to the specified composite database. +However, the behavior does not cascade further, the target of those constituent database aliases are not dropped. Using `CASCADE ALIASES` requires the `DROP ALIAS` privilege (see xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[ALIAS MANAGEMENT privileges]). @@ -42,6 +43,6 @@ The option `RESTRICT` explicitly requests the default behavior of the command. [NOTE] ==== -The `CASCADE ALIASES` option will drop the same aliases that would be given in the error message from trying to drop the database using the `RESTRICT` mode instead. +For composite databases, the aliases that will be dropped when using the `CASCADE ALIASES` option can be found in the `constituents` column of `SHOW DATABASE`. ==== diff --git a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc index 089d378c1..fd21695d8 100644 --- a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc +++ b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc @@ -111,6 +111,7 @@ Remote database aliases targeting the database do not affect the deletion of the By appending `CASCADE ALIASES` to the command `DROP DATABASE`, those local database aliases can be dropped alongside the database. Any remote database aliases targeting the database will not be affected of the `CASCADE ALIASES`, they will simply no longer resolve their targets (which is the same behavior as if they are created targeting a non-existing database). +However, the behavior does not cascade further, if any of the dropped database aliases are constituents to any composite database, those composite databases are not dropped. Using `CASCADE ALIASES` requires the `DROP ALIAS` privilege (see xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[ALIAS MANAGEMENT privileges]). @@ -131,7 +132,7 @@ The option `RESTRICT` explicitly requests the default behavior of the command. [NOTE] ==== -The `CASCADE ALIASES` option will drop the same aliases that would be given in the error message from trying to drop the database using the `RESTRICT` mode instead. +For standard databases, the aliases that will be dropped when using the `CASCADE ALIASES` option can be found in the `aliases` column of `SHOW DATABASE`. ==== [[delete-existing-databases-with-aliases]] From 821a506d7b035b72080cbf3a33b9c488db1afa6d Mon Sep 17 00:00:00 2001 From: Therese Magnusson Date: Thu, 19 Sep 2024 14:40:03 +0200 Subject: [PATCH 05/20] Address review comments --- .../delete-composite-databases.adoc | 16 +++++++-------- .../standard-databases/delete-databases.adoc | 20 ++++++++++--------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc index 17a704b5c..33367b9e0 100644 --- a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc +++ b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc @@ -4,7 +4,7 @@ = Delete composite databases You can delete composite databases using either the command `DROP COMPOSITE DATABASE name` or the more general one `DROP DATABASE name`. -However, keep in mind that the first command will fail if the target database is not composite, while the second one will not fail because it targets any database. +However, keep in mind that the first command targets only composite databases, while the second one targets any database. .Query [source, cypher] @@ -15,14 +15,14 @@ DROP COMPOSITE DATABASE inventory [[composite-databases-delete-with-aliases]] == Delete a composite database with constituent database aliases -In general, deleting a composite database that has constituent database aliases will fail as these aliases need to be dropped first. -This applies to both the local and remote constituent database aliases belonging to the specified composite database. +There are two ways of dropping a composite database with constituent database aliases (local or remote): -By appending `CASCADE ALIASES` to the command `DROP COMPOSITE DATABASE`, those constituent database aliases can be dropped alongside the composite database. -This affects both the local and remote constituent database aliases belonging to the specified composite database. -However, the behavior does not cascade further, the target of those constituent database aliases are not dropped. +* Drop the constituent database aliases first, then use `DROP COMPOSITE DATABASE name` to drop the composite database. +* Use `DROP COMPOSITE DATABASE name CASCADE ALIASES` to also drop the constituent database aliases while dropping the composite database. +This operation does not drop the actual target database of the constituent database aliases. -Using `CASCADE ALIASES` requires the `DROP ALIAS` privilege (see xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[ALIAS MANAGEMENT privileges]). +Using `CASCADE ALIASES` requires the `DROP ALIAS` privilege. +For more information, see xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[ALIAS MANAGEMENT privileges]. Given composite database and database alias: [source, cypher] @@ -43,6 +43,6 @@ The option `RESTRICT` explicitly requests the default behavior of the command. [NOTE] ==== -For composite databases, the aliases that will be dropped when using the `CASCADE ALIASES` option can be found in the `constituents` column of `SHOW DATABASE`. +For composite databases, the aliases that are dropped when using the `CASCADE ALIASES` option can be found in the `constituents` column of `SHOW DATABASE`. ==== diff --git a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc index fd21695d8..d628628ef 100644 --- a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc +++ b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc @@ -106,14 +106,17 @@ DROP DATABASE customers IF EXISTS DUMP DATA [[delete-databases-with-aliases]] === Delete a database with local database aliases targeting it -In general, deleting a database that is the target of any local database aliases will fail due as these aliases need to be dropped first. -Remote database aliases targeting the database do not affect the deletion of the database. +There are two ways of dropping a database that is the target of local database aliases: -By appending `CASCADE ALIASES` to the command `DROP DATABASE`, those local database aliases can be dropped alongside the database. -Any remote database aliases targeting the database will not be affected of the `CASCADE ALIASES`, they will simply no longer resolve their targets (which is the same behavior as if they are created targeting a non-existing database). -However, the behavior does not cascade further, if any of the dropped database aliases are constituents to any composite database, those composite databases are not dropped. +* Drop the local database aliases first, then use `DROP DATABASE name` to drop the database. +Remote database aliases targeting the database do not affect the deletion of the database. +* Use `DROP DATABASE name CASCADE ALIASES` to also drop the local database aliases targeting it while dropping the database. +If any of the dropped database aliases are constituents of composite databases, those composite databases will not be dropped. +This command does not affect the remote database aliases targeting the database being dropped. +They will simply no longer resolve their targets as if they were created targeting a non-existing database. -Using `CASCADE ALIASES` requires the `DROP ALIAS` privilege (see xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[ALIAS MANAGEMENT privileges]). +Using `CASCADE ALIASES` requires the `DROP ALIAS` privilege. +For more information, see xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[ALIAS MANAGEMENT privileges]. Given database and database alias: [source, cypher] @@ -132,15 +135,14 @@ The option `RESTRICT` explicitly requests the default behavior of the command. [NOTE] ==== -For standard databases, the aliases that will be dropped when using the `CASCADE ALIASES` option can be found in the `aliases` column of `SHOW DATABASE`. +For standard databases, the aliases that are dropped when using the `CASCADE ALIASES` option can be found in the `aliases` column of `SHOW DATABASE`. ==== [[delete-existing-databases-with-aliases]] === Delete a database with `RESTRICT`/`CASCADE ALIASES` and other command parts The options `RESTRICT`/`CASCADE ALIASES` can also be combined with `IF EXISTS` and `DUMP DATA`/`DESTROY DATA`. - -An example could look like this: +For example: [source, cypher] ---- From 6b05ee137b64896e65bc2bf1548fdf88f4e9feb7 Mon Sep 17 00:00:00 2001 From: Therese Magnusson Date: Fri, 20 Sep 2024 08:40:21 +0200 Subject: [PATCH 06/20] update examples slightly --- .../composite-databases/delete-composite-databases.adoc | 3 +++ .../standard-databases/delete-databases.adoc | 3 +++ 2 files changed, 6 insertions(+) diff --git a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc index 33367b9e0..cef2da356 100644 --- a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc +++ b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc @@ -24,6 +24,8 @@ This operation does not drop the actual target database of the constituent datab Using `CASCADE ALIASES` requires the `DROP ALIAS` privilege. For more information, see xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[ALIAS MANAGEMENT privileges]. +.Drop a composite database and its consitutent alias +==== Given composite database and database alias: [source, cypher] ---- @@ -36,6 +38,7 @@ Then both the constituent database alias `sweden` and the composite database `mo ---- DROP COMPOSITE DATABASE movies CASCADE ALIASES ---- +==== This behavior would be the same for the more general command `DROP DATABASE name` when using it to drop a composite database. diff --git a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc index d628628ef..b00b71e03 100644 --- a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc +++ b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc @@ -118,6 +118,8 @@ They will simply no longer resolve their targets as if they were created targeti Using `CASCADE ALIASES` requires the `DROP ALIAS` privilege. For more information, see xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[ALIAS MANAGEMENT privileges]. +.Drop a database and the local database alias targeting it +==== Given database and database alias: [source, cypher] ---- @@ -130,6 +132,7 @@ Then both the database alias `films` and the database `movies` will be dropped w ---- DROP DATABASE movies CASCADE ALIASES ---- +==== The option `RESTRICT` explicitly requests the default behavior of the command. From 767b535567d5aa2ab4c234aab1e9b4ff0dc4f5b3 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Tue, 24 Sep 2024 13:45:14 +0100 Subject: [PATCH 07/20] Update modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc --- .../standard-databases/delete-databases.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc index b00b71e03..c785193c4 100644 --- a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc +++ b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc @@ -133,7 +133,7 @@ Then both the database alias `films` and the database `movies` will be dropped w DROP DATABASE movies CASCADE ALIASES ---- ==== - +==== The option `RESTRICT` explicitly requests the default behavior of the command. [NOTE] From 32a35f91c78f62c5c305a1d8eaf188ea77aefc93 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Tue, 24 Sep 2024 13:45:21 +0100 Subject: [PATCH 08/20] Update modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc --- .../standard-databases/delete-databases.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc index c785193c4..36b0377d7 100644 --- a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc +++ b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc @@ -127,7 +127,7 @@ CREATE DATABASE movies CREATE ALIAS films FOR DATABASE movies ---- -Then both the database alias `films` and the database `movies` will be dropped with: +Then, both the database alias `films` and the database `movies` can be dropped with the following: [source, cypher] ---- DROP DATABASE movies CASCADE ALIASES From 2c5af5936b2e817a94d46195f445232821325afa Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Tue, 24 Sep 2024 13:45:34 +0100 Subject: [PATCH 09/20] Update modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc --- .../composite-databases/delete-composite-databases.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc index cef2da356..bb48924ec 100644 --- a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc +++ b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc @@ -33,7 +33,7 @@ CREATE COMPOSITE DATABASE movies CREATE ALIAS movies.sweden FOR DATABASE `swedish-movies` ---- -Then both the constituent database alias `sweden` and the composite database `movies` will be dropped with: +.Delete both the constituent database alias `sweden` and the composite database `movies` [source, cypher] ---- DROP COMPOSITE DATABASE movies CASCADE ALIASES From 4023823ac89100c381b5f1d46e849bf134857367 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Tue, 24 Sep 2024 13:45:41 +0100 Subject: [PATCH 10/20] Update modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc --- .../composite-databases/delete-composite-databases.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc index bb48924ec..7cd1c9617 100644 --- a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc +++ b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc @@ -26,7 +26,7 @@ For more information, see xref:authentication-authorization/dbms-administration. .Drop a composite database and its consitutent alias ==== -Given composite database and database alias: +.Create a composite database and a database alias: [source, cypher] ---- CREATE COMPOSITE DATABASE movies From c42b3136454c3df0074bd87fa1d87848fe2e52e7 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Tue, 24 Sep 2024 13:45:55 +0100 Subject: [PATCH 11/20] Update modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc --- .../standard-databases/delete-databases.adoc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc index 36b0377d7..aaad0d664 100644 --- a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc +++ b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc @@ -120,7 +120,9 @@ For more information, see xref:authentication-authorization/dbms-administration. .Drop a database and the local database alias targeting it ==== -Given database and database alias: +.Delete a database with local database aliases targeting it +==== +The following example assumes that you have a database that is the target of a local database alias: [source, cypher] ---- CREATE DATABASE movies From 99ed2bc430fb18971b46cacfd16cd33d686757c9 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Tue, 24 Sep 2024 15:24:14 +0200 Subject: [PATCH 12/20] editial update of delete composite database page --- .../manage-aliases-composite-databases.adoc | 1 + .../delete-composite-databases.adoc | 30 ++++++++++++++----- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/modules/ROOT/pages/database-administration/aliases/manage-aliases-composite-databases.adoc b/modules/ROOT/pages/database-administration/aliases/manage-aliases-composite-databases.adoc index e1ca3e7f3..b8901f7e1 100644 --- a/modules/ROOT/pages/database-administration/aliases/manage-aliases-composite-databases.adoc +++ b/modules/ROOT/pages/database-administration/aliases/manage-aliases-composite-databases.adoc @@ -160,6 +160,7 @@ SHOW ALIASES FOR DATABASE YIELD * +-----------------------------------------------------------------------------------------------------------------------------------+ ---- +[[delete-composite-database-alias]] == Delete database aliases in composite databases To delete an alias in a composite database, use the `DROP ALIAS FOR DATABASE` command. diff --git a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc index 7cd1c9617..e8168aeb6 100644 --- a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc +++ b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc @@ -3,6 +3,15 @@ [[composite-databases-delete]] = Delete composite databases +There are two ways of deleting a composite database with constituent database aliases (local or remote) by either dropping the constituent database aliases first and then deleting the composite database, or deleting the composite database while also dropping the constituent database aliases. + +[[composite-databases-delete-without-aliases]] +== Delete a composite database + +Before deleting a composite database, you must ensure that it is not in use by any database aliases. +If the composite database is in use, you must first drop the aliases that reference it. +For more information, see xref:database-administration/aliases/manage-aliases-composite-databases.adoc#delete-composite-database-alias[Delete database aliases in composite databases]. + You can delete composite databases using either the command `DROP COMPOSITE DATABASE name` or the more general one `DROP DATABASE name`. However, keep in mind that the first command targets only composite databases, while the second one targets any database. @@ -12,35 +21,40 @@ However, keep in mind that the first command targets only composite databases, w DROP COMPOSITE DATABASE inventory ---- +[role=enterprise-edition label--new-5.24] [[composite-databases-delete-with-aliases]] -== Delete a composite database with constituent database aliases +== Delete a composite database while dropping its constituents -There are two ways of dropping a composite database with constituent database aliases (local or remote): +You can use the `CASCADE ALIASES` option of the `DROP COMPOSITE DATABASE` Cypher command to drop the constituent database aliases while deleting the composite database. -* Drop the constituent database aliases first, then use `DROP COMPOSITE DATABASE name` to drop the composite database. -* Use `DROP COMPOSITE DATABASE name CASCADE ALIASES` to also drop the constituent database aliases while dropping the composite database. -This operation does not drop the actual target database of the constituent database aliases. +[NOTE] +==== +This operation does not deletes the actual target databases of the constituent database aliases. +==== +The `CASCADE ALIASES` option is useful when you want to delete a composite database and its constituent database aliases in one step. Using `CASCADE ALIASES` requires the `DROP ALIAS` privilege. For more information, see xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[ALIAS MANAGEMENT privileges]. .Drop a composite database and its consitutent alias ==== -.Create a composite database and a database alias: +In this example, we create a composite database `movies` and a database alias `movies.sweden` for the database `swedish-movies` and then delete the alias `sweden` and the composite database `movies`. + +.Create a composite database `movies` and a database alias `movies.sweden` for the database `swedish-movies` [source, cypher] ---- CREATE COMPOSITE DATABASE movies CREATE ALIAS movies.sweden FOR DATABASE `swedish-movies` ---- -.Delete both the constituent database alias `sweden` and the composite database `movies` +.Delete the composite database `movies` while also dropping the alias `movies.sweden` [source, cypher] ---- DROP COMPOSITE DATABASE movies CASCADE ALIASES ---- ==== -This behavior would be the same for the more general command `DROP DATABASE name` when using it to drop a composite database. +This behavior is the same for the more general command `DROP DATABASE name` when using it to drop a composite database. The option `RESTRICT` explicitly requests the default behavior of the command. From 8ed9ecd05457685dbfeeb760914a61d133db550d Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Tue, 24 Sep 2024 14:35:11 +0100 Subject: [PATCH 13/20] Update modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc Co-authored-by: Therese Magnusson --- .../composite-databases/delete-composite-databases.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc index e8168aeb6..20f3e4682 100644 --- a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc +++ b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc @@ -34,7 +34,7 @@ This operation does not deletes the actual target databases of the constituent d The `CASCADE ALIASES` option is useful when you want to delete a composite database and its constituent database aliases in one step. Using `CASCADE ALIASES` requires the `DROP ALIAS` privilege. -For more information, see xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[ALIAS MANAGEMENT privileges]. +For more information about this privilege, see xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[ALIAS MANAGEMENT privileges]. .Drop a composite database and its consitutent alias ==== From c670df8a1d3f07fe6c51b211f07ada002fcb2d54 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Tue, 24 Sep 2024 14:35:28 +0100 Subject: [PATCH 14/20] Update modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc Co-authored-by: Therese Magnusson --- .../standard-databases/delete-databases.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc index aaad0d664..0056b5dce 100644 --- a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc +++ b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc @@ -109,7 +109,7 @@ DROP DATABASE customers IF EXISTS DUMP DATA There are two ways of dropping a database that is the target of local database aliases: * Drop the local database aliases first, then use `DROP DATABASE name` to drop the database. -Remote database aliases targeting the database do not affect the deletion of the database. +Remote database aliases targeting the database do not affect the deletion of the database and therefore dos not need to be dropped beforehand. * Use `DROP DATABASE name CASCADE ALIASES` to also drop the local database aliases targeting it while dropping the database. If any of the dropped database aliases are constituents of composite databases, those composite databases will not be dropped. This command does not affect the remote database aliases targeting the database being dropped. From a2e661493605f10e9ad95f3bb2ea142bab8eaeb5 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Tue, 24 Sep 2024 14:35:35 +0100 Subject: [PATCH 15/20] Update modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc Co-authored-by: Therese Magnusson --- .../standard-databases/delete-databases.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc index 0056b5dce..9891580b9 100644 --- a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc +++ b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc @@ -116,7 +116,7 @@ This command does not affect the remote database aliases targeting the database They will simply no longer resolve their targets as if they were created targeting a non-existing database. Using `CASCADE ALIASES` requires the `DROP ALIAS` privilege. -For more information, see xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[ALIAS MANAGEMENT privileges]. +For more information about the privilege, see xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[ALIAS MANAGEMENT privileges]. .Drop a database and the local database alias targeting it ==== From 1afc7d8cc49963730ee4e2dffbcf6f72f7df8600 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Tue, 24 Sep 2024 15:51:41 +0200 Subject: [PATCH 16/20] fix the example and the label --- .../delete-composite-databases.adoc | 2 +- .../standard-databases/delete-databases.adoc | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc index 20f3e4682..0520e2302 100644 --- a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc +++ b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc @@ -21,7 +21,7 @@ However, keep in mind that the first command targets only composite databases, w DROP COMPOSITE DATABASE inventory ---- -[role=enterprise-edition label--new-5.24] +[role=label--new-5.24] [[composite-databases-delete-with-aliases]] == Delete a composite database while dropping its constituents diff --git a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc index 9891580b9..9f02df618 100644 --- a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc +++ b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc @@ -120,23 +120,23 @@ For more information about the privilege, see xref:authentication-authorization/ .Drop a database and the local database alias targeting it ==== -.Delete a database with local database aliases targeting it -==== -The following example assumes that you have a database that is the target of a local database alias: +The following example creates a database `movies` and a local database alias `films` targeting it: + [source, cypher] ---- CREATE DATABASE movies CREATE ALIAS films FOR DATABASE movies ---- -Then, both the database alias `films` and the database `movies` can be dropped with the following: +Then, the database `movies` and the local database alias `films` can be dropped using the following command: + [source, cypher] ---- DROP DATABASE movies CASCADE ALIASES ---- + ==== -==== -The option `RESTRICT` explicitly requests the default behavior of the command. +//The option `RESTRICT` explicitly requests the default behavior of the command. [NOTE] ==== From 41a79e838c7d6c2fd359d7eef24652253988599c Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Tue, 24 Sep 2024 15:59:12 +0200 Subject: [PATCH 17/20] remove we --- .../composite-databases/delete-composite-databases.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc index 0520e2302..e1574e7dc 100644 --- a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc +++ b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc @@ -38,7 +38,7 @@ For more information about this privilege, see xref:authentication-authorization .Drop a composite database and its consitutent alias ==== -In this example, we create a composite database `movies` and a database alias `movies.sweden` for the database `swedish-movies` and then delete the alias `sweden` and the composite database `movies`. +This example shows how to create a composite database `movies` and a database alias `movies.sweden` for the database `swedish-movies` and then delete the alias `sweden` and the composite database `movies`. .Create a composite database `movies` and a database alias `movies.sweden` for the database `swedish-movies` [source, cypher] From b714145bd9888e323830aa52b0da7a6ced8dd135 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Tue, 24 Sep 2024 16:09:53 +0100 Subject: [PATCH 18/20] Update modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc --- .../standard-databases/delete-databases.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc index 9f02df618..8a5767855 100644 --- a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc +++ b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc @@ -136,7 +136,7 @@ DROP DATABASE movies CASCADE ALIASES ---- ==== -//The option `RESTRICT` explicitly requests the default behavior of the command. +The option `RESTRICT` explicitly requests the default behavior of the command. [NOTE] ==== From 31d1e6b6ee472a8d3ac89b8f83b6a06d91a525a0 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Tue, 24 Sep 2024 16:10:18 +0100 Subject: [PATCH 19/20] Update modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc --- .../composite-databases/delete-composite-databases.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc index e1574e7dc..60b50b553 100644 --- a/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc +++ b/modules/ROOT/pages/database-administration/composite-databases/delete-composite-databases.adoc @@ -56,7 +56,7 @@ DROP COMPOSITE DATABASE movies CASCADE ALIASES This behavior is the same for the more general command `DROP DATABASE name` when using it to drop a composite database. -The option `RESTRICT` explicitly requests the default behavior of the command. +//The option `RESTRICT` explicitly requests the default behavior of the command. [NOTE] ==== From 5b88e8c34a577967dc690022743955e6279ee37e Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Tue, 24 Sep 2024 16:15:18 +0100 Subject: [PATCH 20/20] Update modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc Co-authored-by: Therese Magnusson --- .../standard-databases/delete-databases.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc index 8a5767855..71cbe26b5 100644 --- a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc +++ b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc @@ -134,8 +134,8 @@ Then, the database `movies` and the local database alias `films` can be dropped ---- DROP DATABASE movies CASCADE ALIASES ---- - ==== + The option `RESTRICT` explicitly requests the default behavior of the command. [NOTE]