1
0
Fork 0

Merge branch 'devel' of github.com:triAGENS/ArangoDB into devel

This commit is contained in:
Esteban Lombeyda 2014-05-26 15:42:33 +02:00
commit decb3944b2
1 changed files with 41 additions and 0 deletions

View File

@ -537,6 +537,47 @@
return true;
});
////////////////////////////////////////////////////////////////////////////////
/// @brief upgradeGraphs
////////////////////////////////////////////////////////////////////////////////
// update _graphs to new document stucture containing edgeDefinitions
addUpgradeTask("upgradeGraphs", "update _graphs to new document stucture containing edgeDefinitions", function () {
try {
var graphs = db._graphs;
if (graphs === null || graphs === undefined) {
throw "_graphs collection does not exist.";
}
graphs.toArray().forEach(
function(graph) {
if (graph.edgeDefinitions) {
return;
}
var from = [graph.vertices];
var to = [graph.vertices];
var collection = graph.edges;
db._graphs.replace(
graph,
{
edgeDefinitions: [
{
"collection": collection,
"from" : from,
"to" : to
}
]
},
true
)
}
);
} catch (e) {
logger.error("could not upgrade _graphs");
return false;
}
return true;
});
////////////////////////////////////////////////////////////////////////////////
/// @brief setupAal
////////////////////////////////////////////////////////////////////////////////