atrix-orientdb

About
Plugin for the atrix mircoservice framework to setup OrientDB connections
Features
- Connection setup (server & database)
- Tests connection on startup
- Can create database on startup
- Can run migrations on startup
Installation
npm install -S @trigo/atrix
nom install -S @trigo/atrix-orientdb
Usage & Configuration
test_migrations/m00_0_mig,js
NOTE: Migration filenames mut match the regex: /^m(\d+)_(\d+)_(.*).js$/
'use strict';
module.exports = {
up: async (db) => {
await db.class.create('Test', 'V');
},
down: async (db) => {
await db.class.drop('Test', 'V');
},
};
index.js
'use strict';
const atrix = require('@trigo/atrix');
const path = require('path');
const svc = new atrix.Service('orientdb', {
dataSource: {
m1: {
type: 'orientdb',
config: {
server: {
host: '127.0.0.1',
port: 2424,
username: 'root',
password: 'password',
},
db: {
name: 'atrix-orientdb-test',
username: 'root',
password: 'password',
},
migrations: {
dir: path.join(__dirname, './test_migrations'),
runOnStartup: true,
},
createDb: true,
},
},
},
});
atrix.addService(svc);
svc.start();