From a7118a542d7d7912ed168037ad59408c619339b5 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 14 Oct 2020 19:40:27 +0100 Subject: [PATCH] Ignore column renaming if the rename has the same name --- packages/server/src/api/controllers/table.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/server/src/api/controllers/table.js b/packages/server/src/api/controllers/table.js index f6fb2b7627..9ce6493eba 100644 --- a/packages/server/src/api/controllers/table.js +++ b/packages/server/src/api/controllers/table.js @@ -38,8 +38,14 @@ exports.save = async function(ctx) { // if the table obj had an _id then it will have been retrieved const oldTable = ctx.preExisting + // Don't rename if the name is the same + let { _rename } = tableToSave + if (_rename && _rename.old === _rename.updated) { + _rename = null + delete tableToSave._rename + } + // rename row fields when table column is renamed - const { _rename } = tableToSave if (_rename && tableToSave.schema[_rename.updated].type === "link") { throw "Cannot rename a linked field." } else if (_rename && tableToSave.primaryDisplay === _rename.old) {