Search code examples
databasedgraph

How do you drop a Dgraph database?


I am running Dgraph database and the interface through the suggested docker images. Is it possible to run a command that drops all the data from the database and keeps the schema? Or at the very least drop both the data and schema? Or would I just have to delete the docker images and rebuild them?


Solution

  • Unfortunatelly, currently there's only command for dropping both schema and all data. You'll have to use the following HTTP call (or use the query directly in Ratel dashboard, since it uses HTTP communication):

    curl -X POST localhost:8080/alter -d '{"drop_all": true}'
    

    There's also possibility to drop a predicate:

    curl -X POST localhost:8080/alter -d '{"drop_attr": "your_predicate_name"}'