我想编写一个将在 OrientDB 控制台上运行的脚本。该脚本需要删除数据库(如果存在)并创建新数据库。
我正在使用以下命令:
drop database remote:localhost/testgraphdb1 root xyz
create database remote:localhost/testgraphdb1 root xyz local graph;
如何避免当命令尝试删除不存在的数据库时发生错误。
最佳答案
我使用相同的“console.sh myscript.sql”执行过程并遇到了相同的问题。我的搜索引导我来到这里,并跟进了为 OrientDB 创建的问题。截至撰写本文时,这些问题尚未得到解决。我的解决方案是将 drop 语句包装在 myscript.sql 文件中,如下所示:
set ignoreErrors true;
drop database remote:localhost/testgraphdb1 root xyz;
set ignoreErrors false;
create database remote:localhost/testgraphdb1 root xyz local graph;
关于orientdb - 用于删除数据库(如果存在)并在 OrientDB 中创建新数据库的命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21730598/