mirror of https://gitee.com/bigwinds/arangodb
Merge pull request #375 from triAGENS/graph-drop
Graph.drop should check if vertices are used more than once
This commit is contained in:
commit
d6efc0f052
|
@ -68,6 +68,21 @@ function GraphCreationSuite() {
|
|||
graph.drop();
|
||||
},
|
||||
|
||||
testDroppingIfVertexCollectionIsUsedTwice : function () {
|
||||
var Graph = require("org/arangodb/graph").Graph,
|
||||
graph_name = "UnitTestsCollectionGraph",
|
||||
other_graph_name = "UnitTestsCollectionOtherGraph",
|
||||
vertex = "UnitTestsCollectionVertex",
|
||||
edges = "UnitTestsCollectionEdge",
|
||||
other_edges = "UnitTestsCollectionOtherEdges",
|
||||
graph = new Graph(graph_name, vertex, edges),
|
||||
other_graph = new Graph(other_graph_name, vertex, other_edges);
|
||||
|
||||
graph.drop();
|
||||
assertTrue(arangodb.db._collection("UnitTestsCollectionVertex") !== null);
|
||||
other_graph.drop();
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test: Find Graph
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -555,7 +555,10 @@ Graph.prototype.drop = function (waitForSync) {
|
|||
|
||||
gdb.remove(this._properties, true, waitForSync);
|
||||
|
||||
this._vertices.drop();
|
||||
if (gdb.byExample({vertices: this._vertices.name()}).count() === 0) {
|
||||
this._vertices.drop();
|
||||
}
|
||||
|
||||
this._edges.drop();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue