-
Notifications
You must be signed in to change notification settings - Fork 83
Add DROP DATABASE name CASCADE ALIASES
#1805
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
Changes from 12 commits
488a86d
5b7e27e
994f3b9
41be4e4
821a506
6b05ee1
767b535
32a35f9
2c5af59
4023823
c42b313
99ed2bc
8ed9ecd
c670df8
a2e6614
1afc7d8
41a79e8
b714145
31d1e6b
5b88e8c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,12 +3,63 @@ | |
| [[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`. | ||
| 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. | ||
| 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. | ||
|
|
||
| .Query | ||
| [source, cypher] | ||
| ---- | ||
| DROP COMPOSITE DATABASE inventory | ||
| ---- | ||
|
|
||
| [role=enterprise-edition label--new-5.24] | ||
| [[composite-databases-delete-with-aliases]] | ||
| == Delete a composite database while dropping its constituents | ||
|
|
||
| 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. | ||
|
|
||
| [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]. | ||
renetapopova marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| .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`. | ||
| .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 the composite database `movies` while also dropping the alias `movies.sweden` | ||
| [source, cypher] | ||
| ---- | ||
| DROP COMPOSITE DATABASE movies CASCADE ALIASES | ||
Hunterness marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ---- | ||
| ==== | ||
|
|
||
| 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. | ||
|
||
|
|
||
| [NOTE] | ||
| ==== | ||
| For composite databases, the aliases that are dropped when using the `CASCADE ALIASES` option can be found in the `constituents` column of `SHOW DATABASE`. | ||
| ==== | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.