diff --git a/modules/ROOT/pages/database-administration/standard-databases/create-databases.adoc b/modules/ROOT/pages/database-administration/standard-databases/create-databases.adoc index 793763352..fa6115fcf 100644 --- a/modules/ROOT/pages/database-administration/standard-databases/create-databases.adoc +++ b/modules/ROOT/pages/database-administration/standard-databases/create-databases.adoc @@ -206,6 +206,21 @@ CREATE OR REPLACE DATABASE customers This is equivalent to running `DROP DATABASE customers IF EXISTS` followed by `CREATE DATABASE customers`. +Keep in mind that using `CREATE OR REPLACE DATABASE` also removes indexes and constraints. +To preserve them, run the following Cypher commands before the `CREATE OR REPLACE DATABASE` and save their outputs: + +[source, cypher] +---- +SHOW CONSTRAINTS YIELD createStatement AS statement +---- + +[source, cypher] +---- +SHOW INDEXES YIELD createStatement, owningConstraint +WHERE owningConstraint IS NULL +RETURN createStatement AS statement +---- + The behavior of `IF NOT EXISTS` and `OR REPLACE` apply to both standard and composite databases (e.g. a composite database may replace a standard database or another composite database). [NOTE]