overwrite new indexes with previous json value
This commit is contained in:
parent
91a59fa5ad
commit
ce430e63c0
|
@ -193,8 +193,15 @@ function wrap(db, dir, dbsMap) {
|
|||
delete row[idname];
|
||||
|
||||
Object.keys(row).forEach(function (fieldname) {
|
||||
// TODO warn if overriding proper field? (shouldn't be possible)
|
||||
// Ideally it shouldn't be possible to overriding a former proper column,
|
||||
// but when a new indexable field is added, the old value is still in json
|
||||
// TODO one-time upgrade of all rows when a new column is added
|
||||
if (null === row[fieldname] || 'undefined' === typeof row[fieldname] || '' === row[fieldname]) {
|
||||
obj[camelCase(fieldname)] = row[fieldname] || obj[camelCase(fieldname)] || row[fieldname];
|
||||
}
|
||||
else {
|
||||
obj[camelCase(fieldname)] = row[fieldname];
|
||||
}
|
||||
});
|
||||
|
||||
return obj;
|
||||
|
|
Loading…
Reference in New Issue