mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-14 10:12:21 +00:00
Added migration runner that allows for migrations to use server code (#8436)
* Added migration runner that allows for migrations to use server code * Replaced example script in migration runner
This commit is contained in:
parent
ad5b2fe540
commit
2c37ba3cee
2 changed files with 22 additions and 1 deletions
21
migrations/migration-runner.js
Normal file
21
migrations/migration-runner.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
require("babel-register");
|
||||
require("babel-polyfill");
|
||||
|
||||
// This file must use ES5, everything required can be in ES6
|
||||
|
||||
function setUpServer () {
|
||||
var nconf = require('nconf');
|
||||
var mongoose = require('mongoose');
|
||||
var Bluebird = require('bluebird');
|
||||
var setupNconf = require('../website/server/libs/setupNconf');
|
||||
setupNconf();
|
||||
// We require src/server and npt src/index because
|
||||
// 1. nconf is already setup
|
||||
// 2. we don't need clustering
|
||||
require('../website/server/server'); // eslint-disable-line global-require
|
||||
}
|
||||
setUpServer();
|
||||
|
||||
// Replace this with your migration
|
||||
var processUsers = require('./new_stuff');
|
||||
processUsers();
|
||||
|
|
@ -80,4 +80,4 @@ function exiting(code, msg) {
|
|||
process.exit(code);
|
||||
}
|
||||
|
||||
processUsers()
|
||||
module.exports = processUsers;
|
||||
|
|
|
|||
Loading…
Reference in a new issue