arango-tools
Advanced tools
Comparing version 0.1.1 to 0.2.0
{ | ||
"name": "arango-tools", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "tools for working with ArangoDB", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -36,4 +36,4 @@ # ArangoTools | ||
type: 'database', | ||
name: "myapp", | ||
url: "http://localhost:8529", // default | ||
name: 'myapp', | ||
url: 'http://localhost:8529', // default | ||
rootPassword: 'secret', // optional when the database exists! | ||
@@ -53,2 +53,16 @@ options: [ | ||
{ | ||
type: 'searchview', | ||
name: 'placeview', | ||
options: { | ||
links: { | ||
places: { | ||
fields: { | ||
name: { analyzers: ['text_en'] }, | ||
description: { analyzers: ['text_en'] }, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
type: 'geoindex', | ||
@@ -82,2 +96,8 @@ on: 'places', | ||
{ | ||
type: 'searchview', | ||
databaseName: name, | ||
name: 'myview', | ||
options: {}, | ||
}, | ||
{ | ||
type: 'geoindex', | ||
@@ -109,3 +129,3 @@ databaseName: name, | ||
Currently arango-tools can only create a database, a document/edge collection and a GeoIndex. | ||
Other types of indexes as well as graphs and views will be added soon. | ||
Currently arango-tools can create a database, a document/edge collection, a search view and a GeoIndex. | ||
Other types and graphs will be added soon. |
@@ -7,2 +7,3 @@ const { Database } = require('arangojs') | ||
const { geoIndex } = require('./geoIndex') | ||
const { searchView } = require('./searchView') | ||
@@ -83,5 +84,15 @@ async function ensure( | ||
} | ||
case 'geoindex': | ||
case 'geoindex': { | ||
await geoIndex({ connection, ...option }) | ||
break | ||
} | ||
case 'searchview': { | ||
const { message } = await searchView({ | ||
connection, | ||
name: option.name, | ||
options: option.options, | ||
}) | ||
if (message) throw new Error(message) | ||
break | ||
} | ||
default: | ||
@@ -88,0 +99,0 @@ console.log('Not implemented yet: ', option) |
@@ -7,2 +7,3 @@ const assign = require('assign-deep') | ||
const { migrateGeoIndex } = require('./migrateGeoIndex') | ||
const { searchView } = require('./searchView') | ||
const { parse } = require('path') | ||
@@ -65,2 +66,11 @@ | ||
} | ||
case 'searchview': { | ||
const { message } = await searchView({ | ||
connection: await newConnection(rootPass, url), | ||
name: migration.name, | ||
options: migration.options, | ||
}) | ||
if (message) throw new Error(message) | ||
break | ||
} | ||
default: | ||
@@ -67,0 +77,0 @@ console.log('Not implemented yet: ', migration) |
21809
19
571
128