9

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?

4

2 回答 2

23

不幸的是,目前只有删除模式和所有数据的命令。您必须使用以下 HTTP 调用(或直接在 Ratel 仪表板中使用查询,因为它使用 HTTP 通信):

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

也有可能删除谓词:

curl -X POST localhost:8080/alter -d '{"drop_attr": "your_predicate_name"}'
于 2018-03-29T15:26:46.170 回答
3

通过导航到“架构”部分并单击“批量编辑”来删除 Dgraph Ratel 本身的所有数据。在那里,它提供了一个选项,可以将所有数据连同模式一起作为“全部删除”按钮。单击“全部删除”按钮,然后在弹出的文本框中输入“全部删除”,然后单击“全部删除”按钮。它删除所有模式和数据

于 2019-12-12T09:12:15.430 回答