greenlock-store-sequelize.js/db/index.js

26 lines
483 B
JavaScript
Raw Permalink Normal View History

'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));
2019-04-10 14:11:38 +00:00
db[model.name] = model;
});
Object.keys(db).forEach(function (modelName) {
db[modelName].associate(db);
});
return sync(db).then(function () {
return db;
});
};