CharlesTheMan
CharlesTheMan

Reputation: 27

How can I completely clear a Memgraph database

I've run the query MATCH (n) DETACH DELETE n; and I can see that there are no nodes and relationships left. The message says that Memgraph is empty, but I can still see 9 Indexes.

SHOW INDEX INFO; will display them. Do I need to drop them one by one using DROP INDEX ON :Label; and DROP INDEX ON :Label(property);?

How do I delete them all at once?

Droped all nodes and relationships

Upvotes: 0

Views: 290

Answers (1)

CharlesTheMan
CharlesTheMan

Reputation: 27

In the link that @FrancoisVanderseypen has added to his comment there is a link to GitHub issue where this code is located:

CALL schema.assert({}, {}, {}, true) 
YIELD action, key, keys, label, unique
RETURN action, key, keys, label, unique;

The solution is to use schema.assert function.

Upvotes: 0

Related Questions