hedgeagent/1.12.0 #1

Open
sa6anw wants to merge 201 commits from hedgeagent/1.12.0 into hedgeagent/1.10.5
Showing only changes of commit 788676aba4 - Show all commits

View File

@@ -4,7 +4,7 @@ const fs = require('fs')
const path = require('path') const path = require('path')
const Sequelize = require('sequelize') const Sequelize = require('sequelize')
const { cloneDeep } = require('lodash') const { cloneDeep } = require('lodash')
const Umzug = require('umzug') const { SequelizeStorage, Umzug } = require('umzug')
// core // core
const config = require('../config') const config = require('../config')
@@ -66,21 +66,24 @@ Object.keys(db).forEach(function (modelName) {
const umzug = new Umzug({ const umzug = new Umzug({
migrations: { migrations: {
path: path.resolve(__dirname, '..', 'migrations'), glob: path.resolve(__dirname, '..', 'migrations', '*.js'),
params: [ resolve: ({ name, path, context }) => {
sequelize.getQueryInterface(), // Adjust the migration from the new signature to the v2 signature, making easier to upgrade to v3
Sequelize.DataTypes const migration = require(path)
] return {
name,
up: async () => migration.up(context, Sequelize),
down: async () => migration.down(context, Sequelize)
}
}
}, },
context: sequelize.getQueryInterface(),
// Required wrapper function required to prevent winstion issue // Required wrapper function required to prevent winstion issue
// https://github.com/winstonjs/winston/issues/1577 // https://github.com/winstonjs/winston/issues/1577
logging: message => { logging: message => {
logger.info(message) logger.info(message)
}, },
storage: 'sequelize', storage: new SequelizeStorage({ sequelize })
storageOptions: {
sequelize
}
}) })
db.runMigrations = async function runMigrations () { db.runMigrations = async function runMigrations () {