Skip to content

Commit

Permalink
RD-869 Added migration script for updating UserApp.managerIp (#1162)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubama authored Dec 30, 2020
1 parent fc4746e commit a05b866
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions backend/migrations/20201230113319-5_1_1-UpdateManagerIp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const _ = require('lodash');
const UserApp = require('../db/UserAppModel');
const config = require('../config').get();

module.exports = {
up: (queryInterface, Sequelize) => {
UserApp(queryInterface.sequelize, Sequelize)
.findAll()
.then(results =>
_.each(results, userAppRow => {
if (userAppRow.managerIp === '127.0.0.1') {
userAppRow.managerIp = config.manager.ip;
userAppRow.save();
}
})
);
},

down: (/* queryInterface, Sequelize */) => {}
};
2 changes: 1 addition & 1 deletion backend/test/migration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { execSync } = require('child_process');

const config = require('../config').get();

const latestMigration = '20201030110539-5_1_1-MigratePageLayouts.js';
const latestMigration = '20201230113319-5_1_1-UpdateManagerIp.js';

describe('Migration script', () => {
beforeAll(() => execSync('node migration.js up'));
Expand Down

0 comments on commit a05b866

Please sign in to comment.