Browse Source

fix: ignore throwing error in upgrader if error is index already exist

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/7173/head
Pranav C 1 year ago committed by Ramesh Mane
parent
commit
646b50ae00
  1. 9
      packages/nocodb/src/version-upgrader/ncXcdbLTARIndexUpgrader.ts

9
packages/nocodb/src/version-upgrader/ncXcdbLTARIndexUpgrader.ts

@ -75,7 +75,16 @@ async function upgradeModelRelationsIndex({
tn: childModel.table_name,
non_unique: true,
};
// wrap in try catch to skip if index already exists
try {
await sqlClient.indexCreate(indexArgs);
} catch (e) {
// ignore throwing if the error is index already exists
if (!/relation "?.+"? already exists/i.test(e.message)) {
throw e;
}
}
}
break;
}

Loading…
Cancel
Save