diff --git a/js/server/arango-upgrade.js b/js/server/arango-upgrade.js index 047b6d2542..121dbe8be8 100644 --- a/js/server/arango-upgrade.js +++ b/js/server/arango-upgrade.js @@ -200,26 +200,42 @@ function main (argv) { return true; }); - // create the VERSION file - addTask("create VERSION file", 1, function () { - // save "1" into VERSION file - SYS_SAVE(versionFile, "1"); - return true; - }); - // create the _modules collection addTask("setup _modules collection", 1, function () { // create a collection named "_modules" - var modules = db._create("_modules", { isSystem: true }); + if (db._modules !== undefined) { + var modules = db._create("_modules", { isSystem: true }); - if (modules == null) { - console.error("creating modules collection '_modules' failed"); - return false; + if (modules == null) { + console.error("creating modules collection '_modules' failed"); + return false; + } } return true; }); + + // create the _routing collection + addTask("setup _routing collection", 1, function () { + // create a collection named "_routing" + if (db._routing !== undefined) { + var routing = db._create("_routing", { isSystem: true }); - + if (routing == null) { + console.error("creating routing collection '_routing' failed"); + return false; + } + } + return true; + }); + + // create the VERSION file + addTask("create VERSION file", 2, function () { + // save "1" into VERSION file + SYS_SAVE(versionFile, "2"); + return true; + }); + + console.log("Upgrade script " + argv[0] + " started"); console.log("Server VERSION is: " + currentVersion); diff --git a/js/server/modules/org/arangodb/actions.js b/js/server/modules/org/arangodb/actions.js index ae861521d9..8f46d1cbbe 100644 --- a/js/server/modules/org/arangodb/actions.js +++ b/js/server/modules/org/arangodb/actions.js @@ -837,6 +837,7 @@ function reloadRouting () { routing = internal.db._collection("_routing"); if (routing === null) { + // TODO: remove this auto-creation. this should be done by arango-upgrade routing = internal.db._create("_routing", { isSystem: true }); }