26 lines
483 B
JavaScript
26 lines
483 B
JavaScript
'use strict';
|
|
|
|
var path = require('path');
|
|
var sync = require('../sync.js');
|
|
|
|
module.exports = function (sequelize) {
|
|
var db = {};
|
|
|
|
[ 'keypair.js'
|
|
, 'domain.js'
|
|
, 'certificate.js'
|
|
, 'chain.js'
|
|
].forEach(function (file) {
|
|
var model = sequelize['import'](path.join(__dirname, file));
|
|
db[model.name] = model;
|
|
});
|
|
|
|
Object.keys(db).forEach(function (modelName) {
|
|
db[modelName].associate(db);
|
|
});
|
|
|
|
return sync(db).then(function () {
|
|
return db;
|
|
});
|
|
};
|