Commit 0ba8c1d4 authored by Antoine's avatar Antoine
Browse files

Log field migration when applying it.

parent 02b7e363
...@@ -37,7 +37,9 @@ function reduceOperationsDate(oldest, operation) { ...@@ -37,7 +37,9 @@ function reduceOperationsDate(oldest, operation) {
function makeRenameField(Model, formerFieldName, newFieldName) { function makeRenameField(Model, formerFieldName, newFieldName) {
return async function(userId) { return async function(userId) {
let { displayName = '(some model)' } = Model;
try { try {
log.info(`Renaming ${displayName}.${formerFieldName} to ${newFieldName}`);
let allEntities = await Model.all(userId); let allEntities = await Model.all(userId);
for (let entity of allEntities) { for (let entity of allEntities) {
if (typeof entity.id === 'undefined') { if (typeof entity.id === 'undefined') {
...@@ -52,7 +54,7 @@ function makeRenameField(Model, formerFieldName, newFieldName) { ...@@ -52,7 +54,7 @@ function makeRenameField(Model, formerFieldName, newFieldName) {
return true; return true;
} catch (e) { } catch (e) {
log.error( log.error(
`Error while renaming field ${Model.toString()}.${formerFieldName} to ${newFieldName}`, `Error while renaming field ${displayName}.${formerFieldName} to ${newFieldName}:`,
e.toString() e.toString()
); );
return false; return false;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment