Skip to content
Merged
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 @@ -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]
Expand Down
Loading