mirror of https://gitee.com/bigwinds/arangodb
23 lines
892 B
Cheetah
23 lines
892 B
Cheetah
'use strict';
|
|
const db = require('@arangodb').db;
|
|
const documentCollections = <%= JSON.stringify(documentCollections, null, 2) %>;
|
|
const edgeCollections = <%= JSON.stringify(edgeCollections, null, 2) %>;
|
|
|
|
for (const localName of documentCollections) {
|
|
const qualifiedName = module.context.collectionName(localName);
|
|
if (!db._collection(qualifiedName)) {
|
|
db._createDocumentCollection(qualifiedName);
|
|
} else if (module.context.isProduction) {
|
|
console.warn(`collection <%= '$' %>{qualifiedName} already exists. Leaving it untouched.`)
|
|
}
|
|
}
|
|
|
|
for (const localName of edgeCollections) {
|
|
const qualifiedName = module.context.collectionName(localName);
|
|
if (!db._collection(qualifiedName)) {
|
|
db._createEdgeCollection(qualifiedName);
|
|
} else if (module.context.isProduction) {
|
|
console.warn(`collection <%= '$' %>{qualifiedName} already exists. Leaving it untouched.`)
|
|
}
|
|
}
|