Added db migration script and directory.
This commit is contained in:
Родитель
d765e6a556
Коммит
f9c5490638
|
@ -4,7 +4,7 @@ module.exports = function () {
|
|||
util = require('../util');
|
||||
|
||||
/* Load Database Configuration */
|
||||
var db = util.getEnvConf(DB_FIELDS, { prefix: 'DB_' });
|
||||
var db = util.getEnvConfig(DB_FIELDS, { prefix: 'DB_' });
|
||||
|
||||
// use sqlite by defaults if no dialect is specified
|
||||
db.dialect = db.dialect || 'sqlite';
|
||||
|
|
|
@ -6,7 +6,7 @@ module.exports = function () {
|
|||
util = require('../util');
|
||||
|
||||
/* Load S3 Configuration */
|
||||
var s3_conf = util.getEnvConf(S3_FIELDS, { prefix: 'S3_' }),
|
||||
var s3_conf = util.getEnvConfig(S3_FIELDS, { prefix: 'S3_' }),
|
||||
s3_mode = this.app.get('env') === 'production' ? 'nox' : 'mox';
|
||||
|
||||
if (!util.hasFields(s3_conf, ['key', 'secret']))
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
var orm = require('../config/orm').call();
|
||||
var migrator = orm.sequelize.getMigrator({ path: './migrations' });
|
||||
migrator.migrate();
|
2
util.js
2
util.js
|
@ -23,7 +23,7 @@ module.exports = {
|
|||
hasFields: function (o, fields) {
|
||||
return o && fields.every(function (f) { return o[f] !== undefined });
|
||||
},
|
||||
getEnvConf: function (fields, opts) {
|
||||
getEnvConfig: function (fields, opts) {
|
||||
var prefix = opts.prefix || '', conf = {};
|
||||
fields.forEach(function (f) {
|
||||
conf[f] = process.env[(prefix + f).toUpperCase()];
|
||||
|
|
Загрузка…
Ссылка в новой задаче