Skip to content

Commit a05b866

Browse files
authored
RD-869 Added migration script for updating UserApp.managerIp (#1162)
1 parent fc4746e commit a05b866

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const _ = require('lodash');
2+
const UserApp = require('../db/UserAppModel');
3+
const config = require('../config').get();
4+
5+
module.exports = {
6+
up: (queryInterface, Sequelize) => {
7+
UserApp(queryInterface.sequelize, Sequelize)
8+
.findAll()
9+
.then(results =>
10+
_.each(results, userAppRow => {
11+
if (userAppRow.managerIp === '127.0.0.1') {
12+
userAppRow.managerIp = config.manager.ip;
13+
userAppRow.save();
14+
}
15+
})
16+
);
17+
},
18+
19+
down: (/* queryInterface, Sequelize */) => {}
20+
};

backend/test/migration.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { execSync } = require('child_process');
33

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

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

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

0 commit comments

Comments
 (0)