overwrite new indexes with previous json value
Этот коммит содержится в:
родитель
91a59fa5ad
Коммит
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;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user